@@ -43,7 +43,9 @@ async def call_api(
4343 """
4444
4545 try :
46- logger .debug ("HTTP request method: %s; url: %s; header_params: %s" , method , url , header_params )
46+ logger .debug (
47+ "HTTP request method: %s; url: %s; header_params: %s" , method , url , header_params
48+ )
4749 response_data = await self .rest_client .request (
4850 method ,
4951 url ,
@@ -56,7 +58,9 @@ async def call_api(
5658 response_data .status == 401 # noqa: PLR2004 (Unauthorized status code)
5759 and url != self .configuration .host + "/token"
5860 ):
59- logger .warning ("HTTP response from: %s; status code: 401 - obtaining new token" , url )
61+ logger .warning (
62+ "HTTP response from: %s; status code: 401 - obtaining new token" , url
63+ )
6064 async with self ._token_lock :
6165 # The lock is intentionally broad (covers the whole block including the token state)
6266 # to avoid race conditions: without it, other coroutines could mis-evaluate
@@ -67,9 +71,7 @@ async def call_api(
6771 >= self .configuration .token_update_time
6872 + self .configuration .auth_token_ttl_sec
6973 )
70- invalid_token = not self .configuration ._http_config .api_key .get (
71- "api_key"
72- )
74+ invalid_token = not self .configuration ._http_config .api_key .get ("api_key" )
7375
7476 if invalid_token or token_expired :
7577 token = await self .refresh_authorization_token ()
@@ -85,7 +87,9 @@ async def call_api(
8587 _request_timeout = _request_timeout ,
8688 )
8789 except ApiException as e :
88- logger .error ("HTTP request failed url: %s status: %s; reason: %s" , url , e .status , e .reason )
90+ logger .error (
91+ "HTTP request failed url: %s status: %s; reason: %s" , url , e .status , e .reason
92+ )
8993 raise e
9094
9195 return response_data
@@ -111,9 +115,7 @@ def response_deserialize(
111115 and 100 <= response_data .status <= 599
112116 ):
113117 # if not found, look for '1XX', '2XX', etc.
114- response_type = response_types_map .get (
115- str (response_data .status )[0 ] + "XX" , None
116- )
118+ response_type = response_types_map .get (str (response_data .status )[0 ] + "XX" , None )
117119
118120 # deserialize response data
119121 response_text = None
@@ -130,9 +132,7 @@ def response_deserialize(
130132 match = re .search (r"charset=([a-zA-Z\-\d]+)[\s;]?" , content_type )
131133 encoding = match .group (1 ) if match else "utf-8"
132134 response_text = response_data .data .decode (encoding )
133- return_data = self .deserialize (
134- response_text , response_type , content_type
135- )
135+ return_data = self .deserialize (response_text , response_type , content_type )
136136 finally :
137137 if not 200 <= response_data .status <= 299 :
138138 logger .error (f"Unexpected response status code: { response_data .status } " )
0 commit comments