#!/usr/bin/env python3

# http://inamidst.com/saxo/
# Created by Sean B. Palmer

import saxo

@saxo.command()
def get(arg):
    page = saxo.request(arg)
    if page.get("mime") == "text/plain":
        if len(page["text"]) <= 360:
            return page["text"].replace("\n", " ")
        else:
            return "Sorry, this text document is longer than 360 characters"
    else:
        return "Sorry, this is not a text/plain document"
