Skip to content

Commit

Permalink
encode#1066 make BaseClient's auth and proxy accessible using getters…
Browse files Browse the repository at this point in the history
… and setters
  • Loading branch information
cdeler committed Aug 6, 2020
1 parent 0e73be8 commit ad15f4c
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions httpx/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ def __init__(
):
self._base_url = self._enforce_trailing_slash(URL(base_url))

self.auth = auth
self._auth = auth
self._params = QueryParams(params)
self._headers = Headers(headers)
self._cookies = Cookies(cookies)
self.timeout = Timeout(timeout)
self._timeout = Timeout(timeout)
self.max_redirects = max_redirects
self._trust_env = trust_env
self._netrc = NetRCInfo()
Expand Down Expand Up @@ -109,6 +109,22 @@ def _get_proxy_map(
proxy = Proxy(url=proxies) if isinstance(proxies, (str, URL)) else proxies
return {"all": proxy}

@property
def auth(self) -> typing.Optional[AuthTypes]:
return self._auth

@auth.setter
def auth(self, auth: typing.Optional[AuthTypes]) -> None:
self._auth = auth

@property
def timeout(self) -> Timeout:
return self._timeout

@timeout.setter
def timeout(self, timeout: Timeout) -> None:
self._timeout = Timeout(timeout)

@property
def base_url(self) -> URL:
"""
Expand Down

0 comments on commit ad15f4c

Please sign in to comment.