#!/usr/bin/env python3

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

import os
import saxo

@saxo.pipe
def geo(arg):
    nick = os.environ.get("SAXO_NICK", "result")
    page = saxo.request("http://websitedev.de/temp-bin/geo.php",
                        query={"nick": nick, "q": arg})
    text = page["text"]
    if not text.startswith(nick):
        text = text.replace("\\\\", "\\")
    return text
