Skip to content

Commit

Permalink
fixed auth header
Browse files Browse the repository at this point in the history
  • Loading branch information
davidparks21 committed Jul 30, 2024
1 parent ffcdf7d commit 969dd6e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/braingeneers/iot/shadows.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def spawn(self):
creates a new object in the database
"""
url = self.endpoint + "/"+self.api_object_id+"?filters[name][$eq]=" + self.attributes["name"] + "&populate=%2A"
headers = {"Authorization": "Bearer " + self.token + " Bearer " + self.jwt_service_token['access_token']}
headers = {"Authorization": "Bearer " + self.jwt_service_token['access_token']}
response = requests.get(url, headers=headers)
if len(response.json()['data']) == 0:
api_url = self.endpoint+"/"+self.api_object_id+"?populate=%2A"
Expand All @@ -143,7 +143,7 @@ def push(self):
updates the database with the current state of the object
"""
url = self.endpoint + "/"+self.api_object_id+"/" + str(self.id) + "?populate=%2A"
headers = {"Authorization": "Bearer " + self.token + " Bearer " + self.jwt_service_token['access_token']}
headers = {"Authorization": "Bearer " + self.jwt_service_token['access_token']}
data = {"data": self.attributes}
response = requests.put(url, headers=headers, json=data)
self.parse_API_response(response.json()['data'])
Expand All @@ -153,7 +153,7 @@ def pull(self):
updates object with the latest data from the database
"""
url = self.endpoint + "/"+self.api_object_id+"/" + str(self.id) + "?populate=%2A"
headers = {"Authorization": "Bearer " + self.token + " Bearer " + self.jwt_service_token['access_token']}
headers = {"Authorization": "Bearer " + self.jwt_service_token['access_token']}
response = requests.get(url, headers=headers)
if len(response.json()['data']) == 0:
raise Exception("Object not found")
Expand Down

0 comments on commit 969dd6e

Please sign in to comment.