mirror of
https://github.com/ijaric/voice_assistant.git
synced 2025-05-24 14:33:26 +00:00
feat: [#47] http_client proxy may not be passed
This commit is contained in:
parent
4b28117055
commit
eca38ebe25
|
@ -8,7 +8,7 @@ import lib.app.split_settings as app_split_settings
|
||||||
class AsyncHttpClient(httpx.AsyncClient):
|
class AsyncHttpClient(httpx.AsyncClient):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
proxy_settings: app_split_settings.ProxySettings,
|
proxy_settings: app_split_settings.ProxySettings | None = None,
|
||||||
base_url: str | None = None,
|
base_url: str | None = None,
|
||||||
**client_params: typing.Any,
|
**client_params: typing.Any,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -20,7 +20,7 @@ class AsyncHttpClient(httpx.AsyncClient):
|
||||||
super().__init__(base_url=self.base_url, proxies=self.proxies, **client_params) # type: ignore[reportGeneralTypeIssues]
|
super().__init__(base_url=self.base_url, proxies=self.proxies, **client_params) # type: ignore[reportGeneralTypeIssues]
|
||||||
|
|
||||||
def __get_proxies_from_settings(self) -> dict[str, str] | None:
|
def __get_proxies_from_settings(self) -> dict[str, str] | None:
|
||||||
if not self.proxy_settings.enable:
|
if not self.proxy_settings or not self.proxy_settings.enable:
|
||||||
return None
|
return None
|
||||||
proxies = {"all://": self.proxy_settings.dsn}
|
proxies = {"all://": self.proxy_settings.dsn}
|
||||||
return proxies
|
return proxies
|
||||||
|
|
Loading…
Reference in New Issue
Block a user