以下是我到目前为止的Python代码。输入文件的一个例子是
53.4667 -2.2333 Manchester
52.4831 -1.8936 Birmingham
53.4000 -3.0000 Liverpool
48.8567 2.3508 Paris
45.7600 4.8400 Lyon
43.2964 5.3700 Marseille
43.7034 7.2663 Nice
我使用准确度11输入不同城市的纬度和经度,这是城市级别。我想要检索的只是该位置所有图像的标签以及该图像的确切地理位置。我是python的新手,我不认为这段代码正是如此,任何帮助都会受到赞赏!
import flickrapi
api_key = "key"
secret_api_key = "secret key"
flickr = flickrapi.FlickrAPI(api_key, secret_api_key)
def obtainImages():
file = open('citylist.txt')
for line in file:
fields = line.strip().split()
lat = fields[0]
lon = fields[1]
photo_list = flickr.photos.search(api_key=api_key, lat=lat, lon=lon, accuracy=11, format='parsed-json', per_page='100')
print(photo_list)
obtainImages()