Make logout actually work, fixes #5

main
Mark Cotton 2023-09-06 21:30:10 -05:00
parent 0ebdbbe103
commit 2d1a76b9ff
1 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,5 @@
""" Python client for Eagle Eye Networks APIv3 """
version = "0.0.19"
version = "0.0.20"
__version__ = version
@ -184,14 +184,12 @@ class EagleEyev3():
}
headers = {
"Authorization": f"Bearer {self.access_token}",
"Accept": "application/json",
"Content-type": "application/json"
"Content-type": "application/x-www-form-urlencoded"
}
# Send a POST request to obtain the base URL
response = requests.post(url, json=payload, headers=headers, timeout=self._get_timeout_values('logout'))
response_json = response.json()
response = requests.post(url, auth=(self.client_id, self.client_secret), data=payload, headers=headers, timeout=self._get_timeout_values('logout'))
response_text = response.text
logging.info(f"{response.status_code} in logout")
@ -199,7 +197,7 @@ class EagleEyev3():
success = True
else:
success = False
logging.info(f"call to logout: {response_json}")
logging.info(f"call to logout: {response.status_code}")
self.access_token = None
self.refresh_token = None
@ -207,7 +205,7 @@ class EagleEyev3():
return {
"success": success,
"response_http_status": response.status_code,
"data": response_json
"data": response_text
}
def login_from_reseller(self, target_account_id=None, cascade=True):