Skip to content

Commit 934981f

Browse files
authored
fix: correct proxies setting (#424)
1 parent 2165cc5 commit 934981f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

googletrans/client.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,11 @@ class Translator:
5454

5555
def __init__(self, service_urls=DEFAULT_CLIENT_SERVICE_URLS, user_agent=DEFAULT_USER_AGENT,
5656
raise_exception=DEFAULT_RAISE_EXCEPTION,
57-
proxies: typing.Dict[str, httpcore.AsyncHTTPProxy] = None,
58-
timeout: Timeout = None,
57+
proxies: typing.Optional[typing.Dict[typing.Union[str, httpx.URL], typing.Union[str, httpx.Proxy]]] = None,
58+
timeout: typing.Optional[Timeout] = None,
5959
http2=True):
6060

61-
self.client = httpx.Client(http2=http2)
62-
if proxies is not None: # pragma: nocover
63-
self.client.proxies = proxies
61+
self.client = httpx.Client(http2=http2, proxies=proxies)
6462

6563
self.client.headers.update({
6664
'User-Agent': user_agent,
@@ -299,4 +297,4 @@ def detect(self, text, **kwargs):
299297
pass
300298
result = Detected(lang=src, confidence=confidence, response=response)
301299

302-
return result
300+
return result

0 commit comments

Comments
 (0)