Last active
August 29, 2015 14:11
-
-
Save jimr/69ac53457d1a42f719a1 to your computer and use it in GitHub Desktop.
Example flickr.py usage for getting user locations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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