Skip to content

Commit 7995a4a

Browse files
committed
refactor: replace httpx with niquests
Signed-off-by: Edward Ly <[email protected]>
1 parent 95757a6 commit 7995a4a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from threading import Event, Thread
1313
from time import perf_counter, sleep, strftime
1414

15-
import httpx
15+
from niquests import HTTPError
1616
from task_processors import generate_task_processors
1717
from fastapi import FastAPI
1818
from 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)

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pydantic = "2.*"
1414
fastapi = "^0.116.2"
1515
nc-py-api = {extras = ["app"], version = "0.*"}
1616
langchain = "^0.3.27"
17-
httpx = "^0.28.1"
17+
niquests = "^3.15.2"
1818
langchain-community = "^0.3.24"
1919
llama-cpp-python = "^0.3.14"
2020

0 commit comments

Comments
 (0)