Get the underlying httpx.Client, constructing a new one if not previously set
(self)
| 96 | return self |
| 97 | |
| 98 | def get_httpx_client(self) -> httpx.Client: |
| 99 | """Get the underlying httpx.Client, constructing a new one if not previously set""" |
| 100 | # ``verify_ssl=None`` historically meant "fall back to the OS trust |
| 101 | # store" (when the truststore default was injected here). Preserve |
| 102 | # that semantic so callers that bypass ClientSet do not silently |
| 103 | # downgrade to httpx's certifi-only default. |
| 104 | verify = ( |
| 105 | self._verify_ssl if self._verify_ssl is not None else make_ssl_context() |
| 106 | ) |
| 107 | if self._client is None: |
| 108 | self._client = httpx.Client( |
| 109 | base_url=self.versioned_url, |
| 110 | cookies=self._cookies, |
| 111 | headers=self._headers, |
| 112 | timeout=self._timeout, |
| 113 | verify=verify, |
| 114 | follow_redirects=self._follow_redirects, |
| 115 | **self._httpx_args, |
| 116 | ) |
| 117 | return self._client |
| 118 | |
| 119 | def __enter__(self) -> "HTTPClient": |
| 120 | """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" |
no test coverage detected