Skip to content

Instantly share code, notes, and snippets.

@jimr
Last active August 29, 2015 14:11
Show Gist options
  • Save jimr/69ac53457d1a42f719a1 to your computer and use it in GitHub Desktop.
Save jimr/69ac53457d1a42f719a1 to your computer and use it in GitHub Desktop.
Example flickr.py usage for getting user locations
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import flickr
flickr.API_KEY = '<your API key>'
flickr.API_SECRET = '<your API secret>'
# get some photos
photos = flickr.photos_search(tags='manhattan', page='1', per_page='10')
print len(photos)
print photos
# get locations & owners
geolist = []
owners = []
for photo in photos:
owners.append(photo.owner)
if photo.getLocation() != None:
geolist.append(photo.getLocation())
print len(geolist)
print geolist
print len(owners)
print owners
# print user locations
for owner in owners:
print owner.location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment