Write request reson to log if not 200 "OK"

This commit is contained in:
Daniel Tedenljung 2020-12-20 18:38:21 +01:00
parent 65a48a403c
commit 7471face3f

View file

@ -124,6 +124,8 @@ def get_new_data():
key = 'key {}'.format(app_key)
headers = {'Authorization': key, 'Content-Type': 'application/json'}
response = requests.get(endpoint, headers=headers)
if response.status_code != 200:
logger.info(response.reason)
try:
for each_resp in response.json():
if (not Location.query.filter(Location.datetime == each_resp['time']).first() and