(
self,
params: QueryTypes = None,
headers: HeaderTypes = None,
cookies: CookieTypes = None,
version: str | HTTPVersion = HTTPVersion.H11,
timeout: TimeoutTypes | UnsetType = UNSET,
proxy: str | None = None,
)
| 56 | class Session(HTTPClientSession): |
| 57 | @override |
| 58 | def __init__( |
| 59 | self, |
| 60 | params: QueryTypes = None, |
| 61 | headers: HeaderTypes = None, |
| 62 | cookies: CookieTypes = None, |
| 63 | version: str | HTTPVersion = HTTPVersion.H11, |
| 64 | timeout: TimeoutTypes | UnsetType = UNSET, |
| 65 | proxy: str | None = None, |
| 66 | ): |
| 67 | self._client: httpx.AsyncClient | None = None |
| 68 | |
| 69 | self._params = ( |
| 70 | tuple(URL.build(query=params).query.items()) if params is not None else None |
| 71 | ) |
| 72 | self._headers = ( |
| 73 | tuple(CIMultiDict(headers).items()) if headers is not None else None |
| 74 | ) |
| 75 | self._cookies = Cookies(cookies) |
| 76 | self._version = HTTPVersion(version) |
| 77 | |
| 78 | _timeout = None |
| 79 | if isinstance(timeout, Timeout): |
| 80 | avg_timeout = timeout.total and timeout.total / 4 |
| 81 | timeout_kwargs: dict[str, float | None] = exclude_unset( |
| 82 | { |
| 83 | "timeout": avg_timeout, |
| 84 | "connect": timeout.connect, |
| 85 | "read": timeout.read, |
| 86 | } |
| 87 | ) |
| 88 | if timeout_kwargs: |
| 89 | _timeout = httpx.Timeout(**timeout_kwargs) |
| 90 | elif timeout is not UNSET: |
| 91 | _timeout = httpx.Timeout(timeout) |
| 92 | |
| 93 | if _timeout is None: |
| 94 | avg_timeout = DEFAULT_TIMEOUT.total and DEFAULT_TIMEOUT.total / 4 |
| 95 | _timeout = httpx.Timeout( |
| 96 | **exclude_unset( |
| 97 | { |
| 98 | "timeout": avg_timeout, |
| 99 | "connect": DEFAULT_TIMEOUT.connect, |
| 100 | "read": DEFAULT_TIMEOUT.read, |
| 101 | } |
| 102 | ) |
| 103 | ) |
| 104 | |
| 105 | self._timeout = _timeout |
| 106 | self._proxy = proxy |
| 107 | |
| 108 | @property |
| 109 | def client(self) -> httpx.AsyncClient: |
nothing calls this directly
no test coverage detected