Reputation: 553
I'd like to retrieve photos around specified coordinates from flickr by using the python flickrapi wrapper to their API. My minimal example looks like this:
import flickrapi
api_key = "xxxx"
secret_api_key = "xxxx"
flickr = flickrapi.FlickrAPI(api_key, secret_api_key)
lat = 48.83417
lon = 2.221111
photo_list = flickr.photos.geo.photosForLocation(lat=lat, lon=lon, accuracy=11, format="json")
But, I get empty answers, i.e., photo_list looks like this:
'{"photos":{"page":1,"pages":0,"perpage":100,"total":"0","photo":[]},"stat":"ok"}'
Any ideas about what I might be doing wrong?
EDIT
Turns out, retrieving photos using flickr.photos.search() works just fine.
Upvotes: 1
Views: 1346
Reputation: 148
try with the 'search' call instead of the 'photosForLocation', flickr.photos.geo.forLocation is very specific, and will only return photos with an exact match on the latitude and longitude, apparently
import flickrapi
api_key = "<api_key>"
secret_api_key = "<secret_api_key>"
flickr = flickrapi.FlickrAPI(api_key, secret_api_key)
lat = 48.83417
lon = 2.221111
photo_list = flickr.photos.search(api_key=api_key, lat=lat, lon=lon, accuracy=11, format='parsed-json')
print(photo_list)
Upvotes: 2
Reputation: 553
Turns out, retrieving photos using flickr.photos.search() works just fine.
Upvotes: 0