Exemplo n.º 1
0
def handleSearch(message):
    """Enter a human readable address to get the nearest restroom"""
    query = message.body
    if len(query) > 0 and query.split()[0].lower() == "search":
        query = query[1:]
    restrooms = searchForRestroom(query)

    if len(restrooms) < 1:
        return handleNoneFound("")

    r = restrooms[0]
    return restroom(r)
Exemplo n.º 2
0
        query = query[1:]
    restrooms = searchForRestroom(query)

    if len(restrooms) < 1:
        return handleNoneFound("")

    r = restrooms[0]
    return restroom(r)

def handleHelp(message, commandList):
    """HELP - list of commands"""
    listOfCommands = ", ".join(commandList)
    return reply("Text an address to this number in order to find the nearest access to a safe restrooom")


commands = {
    'unknown': handleUnknown,
    'help': handleHelp,
    'search': handleSearch
}


if __name__ == "__main__":
    restrooms = searchForRestroom("Portland, Oregon")
    restroom = restrooms[0]
    bath_str = "Closest Restroom: %s, %s, %s, %s" % (restroom['name'],
                                                     restroom['street'],
                                                     restroom['city'],
                                                     restroom['state'])
    print bath_str