Skip to content

Commit

Permalink
fix: correct proxies setting (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xdynix authored Nov 17, 2024
1 parent 2165cc5 commit 934981f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions googletrans/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ class Translator:

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

self.client = httpx.Client(http2=http2)
if proxies is not None: # pragma: nocover
self.client.proxies = proxies
self.client = httpx.Client(http2=http2, proxies=proxies)

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

return result
return result

0 comments on commit 934981f

Please sign in to comment.