Skip to content

Commit a2ff7c1

Browse files
committed
fix(client): remove deprecated proxies httpx option
1 parent 2f16a4c commit a2ff7c1

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

googletrans/client.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import httpx
1313
from httpx import Response, Timeout
14-
from httpx._types import ProxiesTypes
14+
from httpx._types import ProxyTypes
1515

1616
from googletrans import urls, utils
1717
from googletrans.constants import (
@@ -42,17 +42,11 @@ class Translator:
4242
:param user_agent: the User-Agent header to send when making requests.
4343
:type user_agent: :class:`str`
4444
45-
:param proxies: proxies configuration.
46-
Dictionary mapping protocol or protocol and host to the URL of the proxy
47-
For example ``{'http': 'foo.bar:3128', 'http://host.name': 'foo.bar:4012'}``
48-
:type proxies: dictionary
45+
:param proxy: httpx proxy configuration.
4946
5047
:param timeout: Definition of timeout for httpx library.
5148
Will be used for every request.
5249
:type timeout: number or a double of numbers
53-
:param proxies: proxies configuration.
54-
Dictionary mapping protocol or protocol and host to the URL of the proxy
55-
For example ``{'http': 'foo.bar:3128', 'http://host.name': 'foo.bar:4012'}``
5650
:param raise_exception: if `True` then raise exception if smth will go wrong
5751
:type raise_exception: boolean
5852
"""
@@ -62,14 +56,14 @@ def __init__(
6256
service_urls: typing.Sequence[str] = DEFAULT_CLIENT_SERVICE_URLS,
6357
user_agent: str = DEFAULT_USER_AGENT,
6458
raise_exception: bool = DEFAULT_RAISE_EXCEPTION,
65-
proxies: typing.Optional[ProxiesTypes] = None,
59+
proxy: typing.Optional[ProxyTypes] = None,
6660
timeout: typing.Optional[Timeout] = None,
6761
http2: bool = True,
6862
list_operation_max_concurrency: int = 2,
6963
):
7064
self.client = httpx.AsyncClient(
7165
http2=http2,
72-
proxies=proxies,
66+
proxy=proxy,
7367
headers={
7468
"User-Agent": user_agent,
7569
},

0 commit comments

Comments
 (0)