我希望通过将python flickrapi包装器用于其API,从flickr检索指定坐标周围的照片。我的最小例子如下所示:
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")
但是,我得到空答案,即photo_list看起来像这样:
' {"照片" {"页面":1,"页面":0," perpage":100 "总":" 0""相片":[]}," STAT":" OK"} '
关于我可能做错的任何想法?
修改
事实证明,使用flickr.photos.search()检索照片效果很好。
答案 0 :(得分:2)
尝试搜索'打电话而不是“照片位置”,flickr.photos.geo.forLocation非常具体,只会返回纬度和经度完全匹配的照片,显然
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)
答案 1 :(得分:0)
事实证明,使用flickr.photos.search()检索照片效果很好。