Ejemplo n.º 1
0
    def get_object(self, api_suffix):
        auth_token = "&token=%s" % self.token
        request_string = self.tp_uri + api_suffix + "&format=json" + auth_token

        print(request_string)

        return web.get_text(request_string)
Ejemplo n.º 2
0
def mamma(bot_input, bot_output):
    url = 'https://raw.githubusercontent.com/rdegges/yomomma-api/master/jokes.txt'
    responses = web.get_text(url)
    if responses and len(responses):
        lines = responses.split('\n')
        line = random.choice(lines)
        bot_output.say(line)
Ejemplo n.º 3
0
def quote_person(bot_input, bot_output):
    url = "http://www.iheartquotes.com/api/v1/random?source=%s"
    #second_url = "http://en.wikiquote.org/w/api.php"
    if bot_input.groupdict():
        person_name = bot_input.groupdict()["name"]
        if person_name:
            quote_api = url % person_name.replace(' ','_')
            user_quote = web.get_text(quote_api)
            if user_quote:
                bot_output.say(user_quote)
            else:
                bot_output.say("Never heard of him.")