diff --git a/httpx/_client.py b/httpx/_client.py index 645c83e0f1..fff3668058 100644 --- a/httpx/_client.py +++ b/httpx/_client.py @@ -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() @@ -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: """