MCPcopy
hub / github.com/encode/httpx / __init__

Method __init__

httpx/_client.py:189–221  ·  httpx/_client.py::BaseClient.__init__
(
        self,
        *,
        auth: AuthTypes | None = None,
        params: QueryParamTypes | None = None,
        headers: HeaderTypes | None = None,
        cookies: CookieTypes | None = None,
        timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
        follow_redirects: bool = False,
        max_redirects: int = DEFAULT_MAX_REDIRECTS,
        event_hooks: None | (typing.Mapping[str, list[EventHook]]) = None,
        base_url: URL | str = "",
        trust_env: bool = True,
        default_encoding: str | typing.Callable[[bytes], str] = "utf-8",
    )

Source from the content-addressed store, hash-verified

187
188class BaseClient:
189 def __init__(
190 self,
191 *,
192 auth: AuthTypes | None = None,
193 params: QueryParamTypes | None = None,
194 headers: HeaderTypes | None = None,
195 cookies: CookieTypes | None = None,
196 timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
197 follow_redirects: bool = False,
198 max_redirects: int = DEFAULT_MAX_REDIRECTS,
199 event_hooks: None | (typing.Mapping[str, list[EventHook]]) = None,
200 base_url: URL | str = class="st">"",
201 trust_env: bool = True,
202 default_encoding: str | typing.Callable[[bytes], str] = class="st">"utf-8",
203 ) -> None:
204 event_hooks = {} if event_hooks is None else event_hooks
205
206 self._base_url = self._enforce_trailing_slash(URL(base_url))
207
208 self._auth = self._build_auth(auth)
209 self._params = QueryParams(params)
210 self.headers = Headers(headers)
211 self._cookies = Cookies(cookies)
212 self._timeout = Timeout(timeout)
213 self.follow_redirects = follow_redirects
214 self.max_redirects = max_redirects
215 self._event_hooks = {
216 class="st">"request": list(event_hooks.get(class="st">"request", [])),
217 class="st">"response": list(event_hooks.get(class="st">"response", [])),
218 }
219 self._trust_env = trust_env
220 self._default_encoding = default_encoding
221 self._state = ClientState.UNOPENED
222
223 @property
224 def is_closed(self) -> bool:

Callers

nothing calls this directly

Calls 8

_build_authMethod · 0.95
URLClass · 0.85
QueryParamsClass · 0.85
HeadersClass · 0.85
CookiesClass · 0.85
TimeoutClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected