(
self,
*,
auth: AuthTypes | None = None,
params: QueryParamTypes | None = None,
headers: HeaderTypes | None = None,
cookies: CookieTypes | None = None,
verify: ssl.SSLContext | str | bool = True,
cert: CertTypes | None = None,
http1: bool = True,
http2: bool = False,
proxy: ProxyTypes | None = None,
mounts: None | (typing.Mapping[str, AsyncBaseTransport | None]) = None,
timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
follow_redirects: bool = False,
limits: Limits = DEFAULT_LIMITS,
max_redirects: int = DEFAULT_MAX_REDIRECTS,
event_hooks: None | (typing.Mapping[str, list[EventHook]]) = None,
base_url: URL | str = "",
transport: AsyncBaseTransport | None = None,
trust_env: bool = True,
default_encoding: str | typing.Callable[[bytes], str] = "utf-8",
)
| 1351 | class="st">""" |
| 1352 | |
| 1353 | def __init__( |
| 1354 | self, |
| 1355 | *, |
| 1356 | auth: AuthTypes | None = None, |
| 1357 | params: QueryParamTypes | None = None, |
| 1358 | headers: HeaderTypes | None = None, |
| 1359 | cookies: CookieTypes | None = None, |
| 1360 | verify: ssl.SSLContext | str | bool = True, |
| 1361 | cert: CertTypes | None = None, |
| 1362 | http1: bool = True, |
| 1363 | http2: bool = False, |
| 1364 | proxy: ProxyTypes | None = None, |
| 1365 | mounts: None | (typing.Mapping[str, AsyncBaseTransport | None]) = None, |
| 1366 | timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG, |
| 1367 | follow_redirects: bool = False, |
| 1368 | limits: Limits = DEFAULT_LIMITS, |
| 1369 | max_redirects: int = DEFAULT_MAX_REDIRECTS, |
| 1370 | event_hooks: None | (typing.Mapping[str, list[EventHook]]) = None, |
| 1371 | base_url: URL | str = class="st">"", |
| 1372 | transport: AsyncBaseTransport | None = None, |
| 1373 | trust_env: bool = True, |
| 1374 | default_encoding: str | typing.Callable[[bytes], str] = class="st">"utf-8", |
| 1375 | ) -> None: |
| 1376 | super().__init__( |
| 1377 | auth=auth, |
| 1378 | params=params, |
| 1379 | headers=headers, |
| 1380 | cookies=cookies, |
| 1381 | timeout=timeout, |
| 1382 | follow_redirects=follow_redirects, |
| 1383 | max_redirects=max_redirects, |
| 1384 | event_hooks=event_hooks, |
| 1385 | base_url=base_url, |
| 1386 | trust_env=trust_env, |
| 1387 | default_encoding=default_encoding, |
| 1388 | ) |
| 1389 | |
| 1390 | if http2: |
| 1391 | try: |
| 1392 | import h2 class="cm"># noqa |
| 1393 | except ImportError: class="cm"># pragma: no cover |
| 1394 | raise ImportError( |
| 1395 | class="st">"Using http2=True, but the &class="cm">#x27;h2' package is not installed. " |
| 1396 | class="st">"Make sure to install httpx using `pip install httpx[http2]`." |
| 1397 | ) from None |
| 1398 | |
| 1399 | allow_env_proxies = trust_env and transport is None |
| 1400 | proxy_map = self._get_proxy_map(proxy, allow_env_proxies) |
| 1401 | |
| 1402 | self._transport = self._init_transport( |
| 1403 | verify=verify, |
| 1404 | cert=cert, |
| 1405 | trust_env=trust_env, |
| 1406 | http1=http1, |
| 1407 | http2=http2, |
| 1408 | limits=limits, |
| 1409 | transport=transport, |
| 1410 | ) |
nothing calls this directly
no test coverage detected