1
0
mirror of https://github.com/USA-RedDragon/badnest.git synced 2025-01-18 23:50:43 +00:00

Set auth headers globally after Google login

This commit is contained in:
Nick Babenko 2020-03-10 09:04:17 +00:00
parent 180c46e84d
commit fab05e12cd

View File

@ -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"]: