Skip to content

Instantly share code, notes, and snippets.

@jkishner
Created June 18, 2015 19:52
Show Gist options
  • Save jkishner/736386a585d983dcc842 to your computer and use it in GitHub Desktop.
Save jkishner/736386a585d983dcc842 to your computer and use it in GitHub Desktop.
import requests
import json
import sys
import urllib
import webbrowser
searchTitle = sys.argv[1]
newSearchTitle = urllib.quote(searchTitle, '')
searchYear = sys.argv[2]
data = requests.request('GET','http://www.omdbapi.com/?t=' + newSearchTitle + '&y=' + searchYear + '&r=json&tomatoes=true')
if data.status_code == 200:
response = json.loads(data.text)
title = response['Title']
print title
year = response['Year']
print year
rated = response['Rated']
print rated
released = response['Released']
print released
runtime = response['Runtime']
print runtime
genre = response['Genre']
print genre
director = response['Director']
print director
metascore = response['Metascore']
print metascore
imdbrating = response['imdbRating']
print imdbrating
tomatometer = reponse['tomatoMeter']
print tomatometer
#webbrowser.open('drafts://x-callback-url/create?text=' + img2 + '%0A%0A' + mid2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment