Skip to content

Commit

Permalink
Avoid setting user_token to None
Browse files Browse the repository at this point in the history
  • Loading branch information
nanomad committed Nov 3, 2024
1 parent 055662b commit f655bbd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/saic_ismart_client_ng/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ async def __deserialize(
raise SaicApiException(f"Failed to deserialize response: {e}. Original json was {response.text}") from e

def logout(self):
self.__api_client.user_token = None
self.__api_client.user_token = ''
self.__token_expiration = None

@property
Expand Down
4 changes: 2 additions & 2 deletions src/saic_ismart_client_ng/net/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def __init__(
self.__configuration = configuration
self.__listener = listener
self.__logger = logger
self.__user_token = ""
self.__class_name = ""
self.__user_token: str = ''
self.__class_name: str = ''
self.__client = httpx.AsyncClient(
event_hooks={
"request": [self.__invoke_request_listener, self.__encrypt_request],
Expand Down
4 changes: 4 additions & 0 deletions src/saic_ismart_client_ng/net/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def encrypt_request(
user_token: str = "",
class_name: str = "",
) -> (str, dict):
if user_token is None:
user_token = ""
if class_name is None:
class_name = ""
original_content_type = original_request_headers.get("Content-Type") # 'application/x-www-form-urlencoded'
if not original_content_type:
modified_content_type = "application/json"
Expand Down

0 comments on commit f655bbd

Please sign in to comment.