From bc4924d4b717b3d96bd92a469c1fb4adaf2e7a2f Mon Sep 17 00:00:00 2001 From: JaronStrypsteen <43599458+JaronStrypsteen@users.noreply.github.com> Date: Sun, 13 Dec 2020 17:21:19 +0100 Subject: [PATCH] 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 --- flask_app/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flask_app/app.py b/flask_app/app.py index 7e5f627..0795523 100644 --- a/flask_app/app.py +++ b/flask_app/app.py @@ -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():