Skip to content

Instantly share code, notes, and snippets.

@FranciscoGutierrez
Created March 23, 2017 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FranciscoGutierrez/55eef85af9584b8381bb38427dfc5f5b to your computer and use it in GitHub Desktop.
Save FranciscoGutierrez/55eef85af9584b8381bb38427dfc5f5b to your computer and use it in GitHub Desktop.
Flickr Pics to JSON
import json
import flickrapi
api_key = u'<API KEY HERE>'
api_secret = u'<SECRET HERE>'
flickr = flickrapi.FlickrAPI(api_key, api_secret)
with open('flickr.json', 'w') as jsonfile:
for photo in flickr.walk(tag_mode='all', text='urbex', min_taken_date='2000-01-01', max_taken_date='2001-01-01', extras="url_o,geo,owner_name,date_taken,description"):
row = {'owner': photo.get('owner'), 'ownername': photo.get('ownername'),'title': photo.get('title'), 'url_o':photo.get('url_o'), 'latitude':photo.get('latitude'), 'longitude':photo.get('longitude'), 'datetaken':photo.get('datetaken')}
json.dump(row, jsonfile, sort_keys=False, indent=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment