update app.py

'key' needs to be added in front of the Access Key. I also added 'Content-Type': 'application/json'
Didn't work for me until I changed those 2 things
This commit is contained in:
JaronStrypsteen 2020-12-13 17:21:19 +01:00 committed by GitHub
parent 5858ac1b7f
commit bc4924d4b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,7 +121,8 @@ def get_new_data():
endpoint = "https://{app}.data.thethingsnetwork.org/api/v2/query/{dev}?last={time}".format(
app=application, dev=each_device, time="{}s".format(past_seconds))
logger.info(endpoint)
headers = {"Authorization": app_key}
key = 'key {}'.format(app_key)
headers = {'Authorization': key, 'Content-Type': 'application/json'}
response = requests.get(endpoint, headers=headers)
try:
for each_resp in response.json():