Created
April 11, 2016 09:21
-
-
Save isratmir/74c8e76990492640d29d0a4ebefc77e6 to your computer and use it in GitHub Desktop.
Read forismatic.com quotes from ubuntu cmd
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
#!/usr/bin/python | |
import sys | |
import os | |
import requests | |
import json | |
url = 'http://api.forismatic.com/api/1.0/' | |
params = dict( | |
method='getQuote', | |
format='json', | |
lang=sys.argv[1] | |
) | |
resp = requests.get(url=url, params=params) | |
data = json.loads(resp.text) | |
print data['quoteText'] + '.\n' + data['quoteAuthor'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment