Skip to content

Instantly share code, notes, and snippets.

@isratmir
Created April 11, 2016 09:21
Show Gist options
  • Save isratmir/74c8e76990492640d29d0a4ebefc77e6 to your computer and use it in GitHub Desktop.
Save isratmir/74c8e76990492640d29d0a4ebefc77e6 to your computer and use it in GitHub Desktop.
Read forismatic.com quotes from ubuntu cmd
#!/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