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:
parent
5858ac1b7f
commit
bc4924d4b7
1 changed files with 2 additions and 1 deletions
|
@ -121,7 +121,8 @@ def get_new_data():
|
||||||
endpoint = "https://{app}.data.thethingsnetwork.org/api/v2/query/{dev}?last={time}".format(
|
endpoint = "https://{app}.data.thethingsnetwork.org/api/v2/query/{dev}?last={time}".format(
|
||||||
app=application, dev=each_device, time="{}s".format(past_seconds))
|
app=application, dev=each_device, time="{}s".format(past_seconds))
|
||||||
logger.info(endpoint)
|
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)
|
response = requests.get(endpoint, headers=headers)
|
||||||
try:
|
try:
|
||||||
for each_resp in response.json():
|
for each_resp in response.json():
|
||||||
|
|
Loading…
Add table
Reference in a new issue