1212from threading import Event , Thread
1313from time import perf_counter , sleep , strftime
1414
15- import httpx
15+ from niquests import HTTPError
1616from task_processors import generate_task_processors
1717from fastapi import FastAPI
1818from nc_py_api import AsyncNextcloudApp , NextcloudApp , NextcloudException
@@ -90,7 +90,7 @@ def background_thread_task():
9090 if not response :
9191 sleep (5 )
9292 continue
93- except (NextcloudException , httpx . RequestError , JSONDecodeError ) as e :
93+ except (NextcloudException , HTTPError , JSONDecodeError ) as e :
9494 log (nc , LogLvl .ERROR , f"Network error fetching the next task { e } " )
9595 sleep (5 )
9696 continue
@@ -118,7 +118,7 @@ def background_thread_task():
118118 task ["id" ],
119119 result ,
120120 )
121- except (NextcloudException , httpx . RequestError , JSONDecodeError ) as e :
121+ except (NextcloudException , HTTPError , JSONDecodeError ) as e :
122122 # Error when reporting the result
123123 exception_info = traceback .format_exception (type (e ), e , e .__traceback__ )
124124 log (nc , LogLvl .ERROR , f"Error: { '' .join (exception_info )} " )
@@ -129,7 +129,7 @@ def background_thread_task():
129129 try :
130130 log (nc , LogLvl .ERROR , str (e ))
131131 nc .providers .task_processing .report_result (task ["id" ], error_message = str (e ))
132- except (NextcloudException , httpx . RequestError ) as net_err :
132+ except (NextcloudException , HTTPError ) as net_err :
133133 log (nc , LogLvl .INFO , f"Network error in reporting the error: { net_err } " )
134134
135135 sleep (5 )
0 commit comments