Created
May 12, 2015 06:56
-
-
Save singlerider/4a6e323be48b3ff58670 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
def urban(args): | |
word = args[0].replace(' ','%20') | |
word_url = 'http://api.urbandictionary.com/v0/define?term=' + word | |
word_resp = requests.get(url=word_url) | |
translated_word = json.loads(word_resp.content) | |
found_word = translated_word['list'][0]['word'] | |
definition = translated_word['list'][0]['definition'] | |
example = translated_word['list'][0]['example'] | |
intended_output = "Definition for {}: {}. Example: {}".format("found_word,definition,example") | |
return intended_output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment