Merge pull request #7 from tedenda/WriteResponseToLog
Write request reson to log if not 200 "OK"
This commit is contained in:
commit
e6823c0476
1 changed files with 2 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue