Flickr new policy compliance, user agents are now required

This commit is contained in:
ehpersonal38
2023-03-22 13:22:14 -04:00
parent 9309e23c3f
commit 5dec3cb76a
4 changed files with 5 additions and 1 deletions
+2 -1
View File
@@ -77,8 +77,9 @@ def sendAppriseNotifications(species, confidence, path, date, time, week, latitu
if not comName in flickr_images:
try:
# TODO: Make this work with non-english comnames. Implement the "// convert sci name to English name" logic from overview.php here
headers = {'User-Agent': 'Python_Flickr/1.0'}
url = 'https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key='+str(settings_dict.get('FLICKR_API_KEY'))+'&text='+str(comName)+' bird&sort=relevance&per_page=5&media=photos&format=json&license=2%2C3%2C4%2C5%2C6%2C9&nojsoncallback=1'
resp = requests.get(url=url)
resp = requests.get(url=url, headers=headers)
resp.encoding = "utf-8"
data = resp.json()["photos"]["photo"][0]