mirror of
https://github.com/USA-RedDragon/badnest.git
synced 2025-01-18 19:20:44 +00:00
Set auth headers globally after Google login
This commit is contained in:
parent
180c46e84d
commit
fab05e12cd
@ -96,6 +96,9 @@ class NestAPI():
|
|||||||
r = self._session.post(url=URL_JWT, headers=headers, params=params)
|
r = self._session.post(url=URL_JWT, headers=headers, params=params)
|
||||||
self._user_id = r.json()['claims']['subject']['nestId']['id']
|
self._user_id = r.json()['claims']['subject']['nestId']['id']
|
||||||
self._access_token = r.json()['jwt']
|
self._access_token = r.json()['jwt']
|
||||||
|
self._session.headers.update({
|
||||||
|
"Authorization": f"Basic {self._access_token}",
|
||||||
|
})
|
||||||
|
|
||||||
def _login_dropcam(self):
|
def _login_dropcam(self):
|
||||||
self._session.post(
|
self._session.post(
|
||||||
@ -110,7 +113,6 @@ class NestAPI():
|
|||||||
r = self._session.get(
|
r = self._session.get(
|
||||||
f"{CAMERA_WEBAPI_BASE}/api/cameras."
|
f"{CAMERA_WEBAPI_BASE}/api/cameras."
|
||||||
+ "get_owned_and_member_of_with_properties",
|
+ "get_owned_and_member_of_with_properties",
|
||||||
headers={"Authorization": f"Basic {self._access_token}"},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
for camera in r.json()["items"]:
|
for camera in r.json()["items"]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user