Skip to content

Instantly share code, notes, and snippets.

@marktyers
Created September 6, 2014 16:42
Show Gist options
  • Save marktyers/c23c3d8042ba808b86e5 to your computer and use it in GitHub Desktop.
Save marktyers/c23c3d8042ba808b86e5 to your computer and use it in GitHub Desktop.
Searching Flickr
import json
key = '<YOUR FLICKR API KEY>'
url = 'https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key='+key+'&tags=coventry&format=json&nojsoncallback=1'
response = urllib2.urlopen(url).read()
data = json.loads(response.decode('utf8'))
photos = data['photos']['photo']
for photo in photos:
url = 'https://farm'+str(photo['farm'])+'.staticflickr.com/'+str(photo['server'])+'/'+photo['id']+'_'+photo['secret']+'_q.jpg'
print(photo['title'])
print(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment