@@ -359,10 +359,10 @@ async def request(
359359 if params :
360360 params = {k : v for k , v in params .items () if v is not None } # aiohttp fails to serialize None values
361361
362- logging .debug (f "[DEBUG] Request Headers: { request_headers } " )
363- logging .debug (f "[DEBUG] Files: { files } " )
364- logging .debug (f "[DEBUG] Params: { params } " )
365- logging .debug (f "[DEBUG] Data: { data } " )
362+ logging .debug ("[DEBUG] Request Headers: %s" , request_headers )
363+ logging .debug ("[DEBUG] Files: %s" , files )
364+ logging .debug ("[DEBUG] Params: %s" , params )
365+ logging .debug ("[DEBUG] Data: %s" , data )
366366
367367 if content_type == "application/x-www-form-urlencoded" :
368368 payload_args = self ._create_urlencoded_form_data_args (data or {}, request_headers )
@@ -592,9 +592,9 @@ async def _handle_http_error(
592592 error_message = f"HTTP Error { exc .status } " ,
593593 )
594594
595- logging .debug (f "[DEBUG] API Error: { user_friendly } (Status: { status_code } )" )
595+ logging .debug ("[DEBUG] API Error: %s (Status: %s)" , user_friendly , status_code )
596596 if response_content :
597- logging .debug (f "[DEBUG] Response content: { response_content } " )
597+ logging .debug ("[DEBUG] Response content: %s" , response_content )
598598
599599 # Retry if eligible
600600 if status_code in self .retry_status_codes and retry_count < self .max_retries :
@@ -738,11 +738,9 @@ async def execute(self, client: Optional[ApiClient] = None) -> R:
738738 if isinstance (v , Enum ):
739739 request_dict [k ] = v .value
740740
741- logging .debug (
742- f"[DEBUG] API Request: { self .endpoint .method .value } { self .endpoint .path } "
743- )
744- logging .debug (f"[DEBUG] Request Data: { json .dumps (request_dict , indent = 2 )} " )
745- logging .debug (f"[DEBUG] Query Params: { self .endpoint .query_params } " )
741+ logging .debug ("[DEBUG] API Request: %s %s" , self .endpoint .method .value , self .endpoint .path )
742+ logging .debug ("[DEBUG] Request Data: %s" , json .dumps (request_dict , indent = 2 ))
743+ logging .debug ("[DEBUG] Query Params: %s" , self .endpoint .query_params )
746744
747745 response_json = await client .request (
748746 self .endpoint .method .value ,
@@ -757,11 +755,11 @@ async def execute(self, client: Optional[ApiClient] = None) -> R:
757755 logging .debug ("=" * 50 )
758756 logging .debug ("[DEBUG] RESPONSE DETAILS:" )
759757 logging .debug ("[DEBUG] Status Code: 200 (Success)" )
760- logging .debug (f "[DEBUG] Response Body: { json .dumps (response_json , indent = 2 )} " )
758+ logging .debug ("[DEBUG] Response Body: %s" , json .dumps (response_json , indent = 2 ))
761759 logging .debug ("=" * 50 )
762760
763761 parsed_response = self .endpoint .response_model .model_validate (response_json )
764- logging .debug (f "[DEBUG] Parsed Response: { parsed_response } " )
762+ logging .debug ("[DEBUG] Parsed Response: %s" , parsed_response )
765763 return parsed_response
766764 finally :
767765 if owns_client :
@@ -877,18 +875,21 @@ async def _poll_until_complete(self, client: ApiClient) -> R:
877875 status = TaskStatus .PENDING
878876 for poll_count in range (1 , self .max_poll_attempts + 1 ):
879877 try :
880- logging .debug (f "[DEBUG] Polling attempt #{ poll_count } " )
878+ logging .debug ("[DEBUG] Polling attempt #%s" , poll_count )
881879
882880 request_dict = (
883881 None if self .request is None else self .request .model_dump (exclude_none = True )
884882 )
885883
886884 if poll_count == 1 :
887885 logging .debug (
888- f"[DEBUG] Poll Request: { self .poll_endpoint .method .value } { self .poll_endpoint .path } "
886+ "[DEBUG] Poll Request: %s %s" ,
887+ self .poll_endpoint .method .value ,
888+ self .poll_endpoint .path ,
889889 )
890890 logging .debug (
891- f"[DEBUG] Poll Request Data: { json .dumps (request_dict , indent = 2 ) if request_dict else 'None' } "
891+ "[DEBUG] Poll Request Data: %s" ,
892+ json .dumps (request_dict , indent = 2 ) if request_dict else "None" ,
892893 )
893894
894895 # Query task status
@@ -903,7 +904,7 @@ async def _poll_until_complete(self, client: ApiClient) -> R:
903904
904905 # Check if task is complete
905906 status = self ._check_task_status (response_obj )
906- logging .debug (f "[DEBUG] Task Status: { status } " )
907+ logging .debug ("[DEBUG] Task Status: %s" , status )
907908
908909 # If progress extractor is provided, extract progress
909910 if self .progress_extractor :
@@ -917,15 +918,15 @@ async def _poll_until_complete(self, client: ApiClient) -> R:
917918 result_url = self .result_url_extractor (response_obj )
918919 if result_url :
919920 message = f"Result URL: { result_url } "
920- logging .debug (f "[DEBUG] { message } " )
921+ logging .debug ("[DEBUG] %s" , message )
921922 self ._display_text_on_node (message )
922923 self .final_response = response_obj
923924 if self .progress_extractor :
924925 progress .update (100 )
925926 return self .final_response
926927 if status == TaskStatus .FAILED :
927928 message = f"Task failed: { json .dumps (resp )} "
928- logging .error (f "[DEBUG] { message } " )
929+ logging .error ("[DEBUG] %s" , message )
929930 raise Exception (message )
930931 logging .debug ("[DEBUG] Task still pending, continuing to poll..." )
931932 # Task pending – wait
@@ -939,7 +940,12 @@ async def _poll_until_complete(self, client: ApiClient) -> R:
939940 raise Exception (
940941 f"Polling aborted after { consecutive_errors } network errors: { str (e )} "
941942 ) from e
942- logging .warning ("Network error (%s/%s): %s" , consecutive_errors , max_consecutive_errors , str (e ))
943+ logging .warning (
944+ "Network error (%s/%s): %s" ,
945+ consecutive_errors ,
946+ max_consecutive_errors ,
947+ str (e ),
948+ )
943949 await asyncio .sleep (self .poll_interval )
944950 except Exception as e :
945951 # For other errors, increment count and potentially abort
@@ -949,10 +955,13 @@ async def _poll_until_complete(self, client: ApiClient) -> R:
949955 f"Polling aborted after { consecutive_errors } consecutive errors: { str (e )} "
950956 ) from e
951957
952- logging .error (f "[DEBUG] Polling error: { str (e )} " )
958+ logging .error ("[DEBUG] Polling error: %s" , str (e ))
953959 logging .warning (
954- f"Error during polling (attempt { poll_count } /{ self .max_poll_attempts } ): { str (e )} . "
955- f"Will retry in { self .poll_interval } seconds."
960+ "Error during polling (attempt %s/%s): %s. Will retry in %s seconds." ,
961+ poll_count ,
962+ self .max_poll_attempts ,
963+ str (e ),
964+ self .poll_interval ,
956965 )
957966 await asyncio .sleep (self .poll_interval )
958967
0 commit comments