diff --git a/.changeset/default_to_httpx2.md b/.changeset/default_to_httpx2.md new file mode 100644 index 000000000..3fc1c4f5d --- /dev/null +++ b/.changeset/default_to_httpx2.md @@ -0,0 +1,5 @@ +--- +default: major +--- + +# Default to using httpx2 and drop support for httpx entirely diff --git a/end_to_end_tests/functional_tests/generated_code_execution/test_path_parameters.py b/end_to_end_tests/functional_tests/generated_code_execution/test_path_parameters.py index de03a2bd9..6439f4d90 100644 --- a/end_to_end_tests/functional_tests/generated_code_execution/test_path_parameters.py +++ b/end_to_end_tests/functional_tests/generated_code_execution/test_path_parameters.py @@ -1,6 +1,6 @@ from unittest.mock import MagicMock -import httpx +import httpx2 from end_to_end_tests.functional_tests.helpers import ( with_generated_client_fixture, @@ -44,8 +44,8 @@ class TestPathParameterEncoding: def test_path_params_with_normal_chars_work(self, sync_detailed, Client): """Test that normal alphanumeric path parameters still work correctly""" - mock_httpx_client = MagicMock(spec=httpx.Client) - mock_response = MagicMock(spec=httpx.Response) + mock_httpx_client = MagicMock(spec=httpx2.Client) + mock_response = MagicMock(spec=httpx2.Response) mock_response.status_code = 200 mock_response.json.return_value = {"id": "test"} mock_response.content = b'{"id": "test"}' @@ -70,16 +70,16 @@ def test_path_params_with_normal_chars_work(self, sync_detailed, Client): def test_path_params_with_reserved_chars_are_encoded(self, sync_detailed, Client): """Test that path parameters with reserved characters are properly URL-encoded""" - # Create a mock httpx client - mock_httpx_client = MagicMock(spec=httpx.Client) - mock_response = MagicMock(spec=httpx.Response) + # Create a mock httpx2 client + mock_httpx_client = MagicMock(spec=httpx2.Client) + mock_response = MagicMock(spec=httpx2.Response) mock_response.status_code = 200 mock_response.json.return_value = {"id": "test"} mock_response.content = b'{"id": "test"}' mock_response.headers = {} mock_httpx_client.request.return_value = mock_response - # Create a client with the mock httpx client + # Create a client with the mock httpx2 client client = Client(base_url="https://api.example.com") client.set_httpx_client(mock_httpx_client) @@ -100,8 +100,8 @@ def test_path_params_with_reserved_chars_are_encoded(self, sync_detailed, Client def test_path_params_with_spaces_are_encoded(self, sync_detailed, Client): """Test that path parameters with spaces are properly URL-encoded""" - mock_httpx_client = MagicMock(spec=httpx.Client) - mock_response = MagicMock(spec=httpx.Response) + mock_httpx_client = MagicMock(spec=httpx2.Client) + mock_response = MagicMock(spec=httpx2.Response) mock_response.status_code = 200 mock_response.json.return_value = {"id": "test"} mock_response.content = b'{"id": "test"}' @@ -126,8 +126,8 @@ def test_path_params_with_spaces_are_encoded(self, sync_detailed, Client): def test_path_params_with_hash_are_encoded(self, sync_detailed, Client): """Test that path parameters with hash/fragment characters are properly URL-encoded""" - mock_httpx_client = MagicMock(spec=httpx.Client) - mock_response = MagicMock(spec=httpx.Response) + mock_httpx_client = MagicMock(spec=httpx2.Client) + mock_response = MagicMock(spec=httpx2.Response) mock_response.status_code = 200 mock_response.json.return_value = {"id": "test"} mock_response.content = b'{"id": "test"}' diff --git a/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/README.md b/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/README.md index 32f776550..9f28b7953 100644 --- a/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/README.md +++ b/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/README.md @@ -76,7 +76,7 @@ Things to know: ## Advanced customizations -There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case): +There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx2.Client` or `httpx2.AsyncClient` (depending on your use-case): ```python from my_test_api_client import Client @@ -90,23 +90,23 @@ def log_response(response): client = Client( base_url="https://api.example.com", - httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, + httpx2_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, ) -# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() +# Or get the underlying httpx2 client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() ``` -You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url): +You can even set the httpx2 client directly, but beware that this will override any existing settings (e.g., base_url): ```python -import httpx +import httpx2 from my_test_api_client import Client client = Client( base_url="https://api.example.com", ) # Note that base_url needs to be re-set, as would any shared cookies, headers, etc. -client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030")) +client.set_httpx_client(httpx2.Client(base_url="https://api.example.com", proxy="http://localhost:8030")) ``` ## Building / publishing this package diff --git a/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/my_test_api_client/client.py b/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/my_test_api_client/client.py index a11b85c36..637a1aeb4 100644 --- a/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/my_test_api_client/client.py +++ b/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/my_test_api_client/client.py @@ -1,7 +1,7 @@ import ssl from typing import Any, Self -import httpx +import httpx2 from attrs import define, evolve, field @@ -9,7 +9,7 @@ class Client: """A class for keeping track of data related to the API - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -18,14 +18,14 @@ class Client: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx2_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. """ @@ -34,12 +34,12 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") - _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _httpx2_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx2_args") + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -57,7 +57,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "Client": + def with_timeout(self, timeout: httpx2.Timeout) -> "Client": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -65,66 +65,66 @@ def with_timeout(self, timeout: httpx.Timeout) -> "Client": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> Self: - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> Self: + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._client def __enter__(self) -> Self: - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self: - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._async_client async def __aenter__(self) -> Self: - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) @@ -132,7 +132,7 @@ async def __aexit__(self, *args: Any, **kwargs: Any) -> None: class AuthenticatedClient: """A Client which has been authenticated for use on secured endpoints - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -141,14 +141,14 @@ class AuthenticatedClient: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx2_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. """ @@ -157,12 +157,12 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") - _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _httpx2_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx2_args") + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) token: str """The token to use for authentication""" @@ -187,7 +187,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": + def with_timeout(self, timeout: httpx2.Timeout) -> "AuthenticatedClient": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -195,66 +195,66 @@ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> Self: - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> Self: + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._client def __enter__(self) -> Self: - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self: - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._async_client async def __aenter__(self) -> Self: - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) diff --git a/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/my_test_api_client/types.py b/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/my_test_api_client/types.py index b64af0952..9090a2620 100644 --- a/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/my_test_api_client/types.py +++ b/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/my_test_api_client/types.py @@ -14,7 +14,7 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() -# The types that `httpx.Client(files=)` can accept, copied from that library. +# The types that `httpx2.Client(files=)` can accept, copied from that library. FileContent = IO[bytes] | bytes | str FileTypes = ( # (filename, file (or bytes), content_type) @@ -34,7 +34,7 @@ class File: mime_type: str | None = None def to_tuple(self) -> FileTypes: - """Return a tuple representation that httpx will accept for multipart/form-data""" + """Return a tuple representation that httpx2 will accept for multipart/form-data""" return self.file_name, self.payload, self.mime_type diff --git a/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/pyproject.toml b/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/pyproject.toml index f2498ce1a..7906f7ea6 100644 --- a/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/pyproject.toml +++ b/end_to_end_tests/golden-records/docstrings-on-attributes-golden-record/pyproject.toml @@ -11,8 +11,8 @@ include = ["my_test_api_client/py.typed"] [tool.poetry.dependencies] python = "^3.11" -httpx = ">=0.23.1,<0.29.0" -attrs = ">=22.2.0" +httpx2 = ">=2.13.1,<3" +attrs = ">=22.2.0" [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"] diff --git a/end_to_end_tests/golden-records/escapes-client/README.md b/end_to_end_tests/golden-records/escapes-client/README.md index 40b4957f5..776cf46df 100644 --- a/end_to_end_tests/golden-records/escapes-client/README.md +++ b/end_to_end_tests/golden-records/escapes-client/README.md @@ -76,7 +76,7 @@ Things to know: ## Advanced customizations -There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case): +There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx2.Client` or `httpx2.AsyncClient` (depending on your use-case): ```python from escapes_client import Client @@ -90,23 +90,23 @@ def log_response(response): client = Client( base_url="https://api.example.com", - httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, + httpx2_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, ) -# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() +# Or get the underlying httpx2 client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() ``` -You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url): +You can even set the httpx2 client directly, but beware that this will override any existing settings (e.g., base_url): ```python -import httpx +import httpx2 from escapes_client import Client client = Client( base_url="https://api.example.com", ) # Note that base_url needs to be re-set, as would any shared cookies, headers, etc. -client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030")) +client.set_httpx_client(httpx2.Client(base_url="https://api.example.com", proxy="http://localhost:8030")) ``` ## Building / publishing this package diff --git a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/get_weird_responses.py b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/get_weird_responses.py index 81a43a14b..c82bc005a 100644 --- a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/get_weird_responses.py +++ b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/get_weird_responses.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -18,14 +18,14 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -41,7 +41,7 @@ def sync_detailed( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -63,7 +63,7 @@ async def asyncio_detailed( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/misc_metadata_escapes.py b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/misc_metadata_escapes.py index adabb42d1..ed514a8ee 100644 --- a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/misc_metadata_escapes.py +++ b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/misc_metadata_escapes.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any, cast -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -28,7 +28,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> str | None: if response.status_code == 200: response_200 = cast(str, response.json()) return response_200 @@ -39,7 +39,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[str]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,7 +59,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[str] @@ -87,7 +87,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: str @@ -110,7 +110,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[str] @@ -136,7 +136,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: str diff --git a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/non_string_example.py b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/non_string_example.py index 7090834e2..3c6a7debb 100644 --- a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/non_string_example.py +++ b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/non_string_example.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -28,7 +28,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -38,7 +38,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -58,7 +58,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -86,7 +86,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/property_escapes.py b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/property_escapes.py index 8a62c1764..b91017244 100644 --- a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/property_escapes.py +++ b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/property_escapes.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -28,7 +28,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -38,7 +38,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -58,7 +58,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -86,7 +86,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/printtag_escape/with_braces_path.py b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/printtag_escape/with_braces_path.py index cbbbc3541..112b39a08 100644 --- a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/printtag_escape/with_braces_path.py +++ b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/printtag_escape/with_braces_path.py @@ -2,7 +2,7 @@ from typing import Any from urllib.parse import quote -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -40,7 +40,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -50,7 +50,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -77,7 +77,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -114,7 +114,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/escapes-client/escapes_client/client.py b/end_to_end_tests/golden-records/escapes-client/escapes_client/client.py index edb246d7e..bdb085ef5 100644 --- a/end_to_end_tests/golden-records/escapes-client/escapes_client/client.py +++ b/end_to_end_tests/golden-records/escapes-client/escapes_client/client.py @@ -1,7 +1,7 @@ import ssl from typing import Any, Self -import httpx +import httpx2 from attrs import define, evolve, field @@ -9,7 +9,7 @@ class Client: """A class for keeping track of data related to the API - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -18,14 +18,14 @@ class Client: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx2_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. Attributes: @@ -38,12 +38,12 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") - _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _httpx2_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx2_args") + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -61,7 +61,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "Client": + def with_timeout(self, timeout: httpx2.Timeout) -> "Client": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -69,66 +69,66 @@ def with_timeout(self, timeout: httpx.Timeout) -> "Client": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> Self: - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> Self: + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._client def __enter__(self) -> Self: - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self: - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._async_client async def __aenter__(self) -> Self: - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) @@ -136,7 +136,7 @@ async def __aexit__(self, *args: Any, **kwargs: Any) -> None: class AuthenticatedClient: """A Client which has been authenticated for use on secured endpoints - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -145,14 +145,14 @@ class AuthenticatedClient: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx2_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. Attributes: @@ -168,12 +168,12 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") - _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _httpx2_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx2_args") + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) token: str prefix: str = "Bearer" @@ -195,7 +195,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": + def with_timeout(self, timeout: httpx2.Timeout) -> "AuthenticatedClient": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -203,66 +203,66 @@ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> Self: - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> Self: + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._client def __enter__(self) -> Self: - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self: - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._async_client async def __aenter__(self) -> Self: - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) diff --git a/end_to_end_tests/golden-records/escapes-client/escapes_client/types.py b/end_to_end_tests/golden-records/escapes-client/escapes_client/types.py index b64af0952..9090a2620 100644 --- a/end_to_end_tests/golden-records/escapes-client/escapes_client/types.py +++ b/end_to_end_tests/golden-records/escapes-client/escapes_client/types.py @@ -14,7 +14,7 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() -# The types that `httpx.Client(files=)` can accept, copied from that library. +# The types that `httpx2.Client(files=)` can accept, copied from that library. FileContent = IO[bytes] | bytes | str FileTypes = ( # (filename, file (or bytes), content_type) @@ -34,7 +34,7 @@ class File: mime_type: str | None = None def to_tuple(self) -> FileTypes: - """Return a tuple representation that httpx will accept for multipart/form-data""" + """Return a tuple representation that httpx2 will accept for multipart/form-data""" return self.file_name, self.payload, self.mime_type diff --git a/end_to_end_tests/golden-records/escapes-client/pyproject.toml b/end_to_end_tests/golden-records/escapes-client/pyproject.toml index 1a167e041..72dc824f2 100644 --- a/end_to_end_tests/golden-records/escapes-client/pyproject.toml +++ b/end_to_end_tests/golden-records/escapes-client/pyproject.toml @@ -11,8 +11,8 @@ include = ["escapes_client/py.typed"] [tool.poetry.dependencies] python = "^3.11" -httpx = ">=0.23.1,<0.29.0" -attrs = ">=22.2.0" +httpx2 = ">=2.13.1,<3" +attrs = ">=22.2.0" [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"] diff --git a/end_to_end_tests/golden-records/my-enum-api-client/README.md b/end_to_end_tests/golden-records/my-enum-api-client/README.md index 025b5d402..0655c8dab 100644 --- a/end_to_end_tests/golden-records/my-enum-api-client/README.md +++ b/end_to_end_tests/golden-records/my-enum-api-client/README.md @@ -76,7 +76,7 @@ Things to know: ## Advanced customizations -There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case): +There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx2.Client` or `httpx2.AsyncClient` (depending on your use-case): ```python from my_enum_api_client import Client @@ -90,23 +90,23 @@ def log_response(response): client = Client( base_url="https://api.example.com", - httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, + httpx2_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, ) -# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() +# Or get the underlying httpx2 client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() ``` -You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url): +You can even set the httpx2 client directly, but beware that this will override any existing settings (e.g., base_url): ```python -import httpx +import httpx2 from my_enum_api_client import Client client = Client( base_url="https://api.example.com", ) # Note that base_url needs to be re-set, as would any shared cookies, headers, etc. -client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030")) +client.set_httpx_client(httpx2.Client(base_url="https://api.example.com", proxy="http://localhost:8030")) ``` ## Building / publishing this package diff --git a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/bool_enum_tests_bool_enum_post.py b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/bool_enum_tests_bool_enum_post.py index 53b574ebd..b1d18c7a7 100644 --- a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/bool_enum_tests_bool_enum_post.py +++ b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/bool_enum_tests_bool_enum_post.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -28,7 +28,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -38,7 +38,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,7 +59,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -88,7 +88,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/int_enum_tests_int_enum_post.py b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/int_enum_tests_int_enum_post.py index f936104b5..a61994293 100644 --- a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/int_enum_tests_int_enum_post.py +++ b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/int_enum_tests_int_enum_post.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -30,7 +30,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -40,7 +40,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +61,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -90,7 +90,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/get_user_list.py b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/get_user_list.py index 15b821528..71a071755 100644 --- a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/get_user_list.py +++ b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/get_user_list.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -66,7 +66,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[AModel] | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> list[AModel] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -83,7 +83,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[AModel]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[list[AModel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -114,7 +114,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[list[AModel]] @@ -157,7 +157,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: list[AModel] @@ -195,7 +195,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[list[AModel]] @@ -236,7 +236,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: list[AModel] diff --git a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/post_user_list.py b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/post_user_list.py index 911d81248..3263c1bc3 100644 --- a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/post_user_list.py +++ b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/post_user_list.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -30,7 +30,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[AModel] | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> list[AModel] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -47,7 +47,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[AModel]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[list[AModel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +70,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[list[AModel]] @@ -101,7 +101,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: list[AModel] @@ -127,7 +127,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[list[AModel]] @@ -156,7 +156,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: list[AModel] diff --git a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/client.py b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/client.py index edb246d7e..bdb085ef5 100644 --- a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/client.py +++ b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/client.py @@ -1,7 +1,7 @@ import ssl from typing import Any, Self -import httpx +import httpx2 from attrs import define, evolve, field @@ -9,7 +9,7 @@ class Client: """A class for keeping track of data related to the API - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -18,14 +18,14 @@ class Client: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx2_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. Attributes: @@ -38,12 +38,12 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") - _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _httpx2_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx2_args") + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -61,7 +61,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "Client": + def with_timeout(self, timeout: httpx2.Timeout) -> "Client": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -69,66 +69,66 @@ def with_timeout(self, timeout: httpx.Timeout) -> "Client": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> Self: - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> Self: + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._client def __enter__(self) -> Self: - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self: - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._async_client async def __aenter__(self) -> Self: - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) @@ -136,7 +136,7 @@ async def __aexit__(self, *args: Any, **kwargs: Any) -> None: class AuthenticatedClient: """A Client which has been authenticated for use on secured endpoints - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -145,14 +145,14 @@ class AuthenticatedClient: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx2_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. Attributes: @@ -168,12 +168,12 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") - _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _httpx2_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx2_args") + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) token: str prefix: str = "Bearer" @@ -195,7 +195,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": + def with_timeout(self, timeout: httpx2.Timeout) -> "AuthenticatedClient": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -203,66 +203,66 @@ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> Self: - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> Self: + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._client def __enter__(self) -> Self: - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self: - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._async_client async def __aenter__(self) -> Self: - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) diff --git a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/types.py b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/types.py index b64af0952..9090a2620 100644 --- a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/types.py +++ b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/types.py @@ -14,7 +14,7 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() -# The types that `httpx.Client(files=)` can accept, copied from that library. +# The types that `httpx2.Client(files=)` can accept, copied from that library. FileContent = IO[bytes] | bytes | str FileTypes = ( # (filename, file (or bytes), content_type) @@ -34,7 +34,7 @@ class File: mime_type: str | None = None def to_tuple(self) -> FileTypes: - """Return a tuple representation that httpx will accept for multipart/form-data""" + """Return a tuple representation that httpx2 will accept for multipart/form-data""" return self.file_name, self.payload, self.mime_type diff --git a/end_to_end_tests/golden-records/my-enum-api-client/pyproject.toml b/end_to_end_tests/golden-records/my-enum-api-client/pyproject.toml index a7b5ed278..b92de3c1a 100644 --- a/end_to_end_tests/golden-records/my-enum-api-client/pyproject.toml +++ b/end_to_end_tests/golden-records/my-enum-api-client/pyproject.toml @@ -11,8 +11,8 @@ include = ["my_enum_api_client/py.typed"] [tool.poetry.dependencies] python = "^3.11" -httpx = ">=0.23.1,<0.29.0" -attrs = ">=22.2.0" +httpx2 = ">=2.13.1,<3" +attrs = ">=22.2.0" [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"] diff --git a/end_to_end_tests/golden-records/my-test-api-client/README.md b/end_to_end_tests/golden-records/my-test-api-client/README.md index 32f776550..9f28b7953 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/README.md +++ b/end_to_end_tests/golden-records/my-test-api-client/README.md @@ -76,7 +76,7 @@ Things to know: ## Advanced customizations -There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case): +There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx2.Client` or `httpx2.AsyncClient` (depending on your use-case): ```python from my_test_api_client import Client @@ -90,23 +90,23 @@ def log_response(response): client = Client( base_url="https://api.example.com", - httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, + httpx2_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, ) -# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() +# Or get the underlying httpx2 client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() ``` -You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url): +You can even set the httpx2 client directly, but beware that this will override any existing settings (e.g., base_url): ```python -import httpx +import httpx2 from my_test_api_client import Client client = Client( base_url="https://api.example.com", ) # Note that base_url needs to be re-set, as would any shared cookies, headers, etc. -client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030")) +client.set_httpx_client(httpx2.Client(base_url="https://api.example.com", proxy="http://localhost:8030")) ``` ## Building / publishing this package diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/json_like.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/json_like.py index 1a4fc2fd9..037f29e94 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/json_like.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/json_like.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -29,7 +29,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -39,7 +39,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,7 +60,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -89,7 +89,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/optional_body.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/optional_body.py index 8402cf086..d5f2c50b9 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/optional_body.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/optional_body.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -29,7 +29,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -39,7 +39,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,7 +60,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -89,7 +89,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/post_bodies_multiple.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/post_bodies_multiple.py index 9361e3f56..25348b3f7 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/post_bodies_multiple.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/post_bodies_multiple.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -45,7 +45,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -55,7 +55,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,7 +79,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -111,7 +111,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/refs.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/refs.py index 2e224bc8c..920b433d6 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/refs.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/refs.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -29,7 +29,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -39,7 +39,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,7 +60,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -89,7 +89,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/config/content_type_override.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/config/content_type_override.py index be06459be..b0caf1f6d 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/config/content_type_override.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/config/content_type_override.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any, cast -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -28,7 +28,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> str | None: if response.status_code == 200: response_200 = cast(str, response.json()) return response_200 @@ -39,7 +39,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[str]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,7 +60,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[str] @@ -89,7 +89,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: str @@ -113,7 +113,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[str] @@ -140,7 +140,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: str diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_common_parameters.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_common_parameters.py index c82055686..004570e86 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_common_parameters.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_common_parameters.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -28,7 +28,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -38,7 +38,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -58,7 +58,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -86,7 +86,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_allof.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_allof.py index 3558ef1be..bf3061de4 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_allof.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_allof.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -20,7 +20,7 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> GetModelsAllofResponse200 | None: if response.status_code == 200: response_200 = GetModelsAllofResponse200.from_dict(response.json()) @@ -34,7 +34,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[GetModelsAllofResponse200]: return Response( status_code=HTTPStatus(response.status_code), @@ -51,7 +51,7 @@ def sync_detailed( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[GetModelsAllofResponse200] @@ -73,7 +73,7 @@ def sync( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: GetModelsAllofResponse200 @@ -91,7 +91,7 @@ async def asyncio_detailed( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[GetModelsAllofResponse200] @@ -111,7 +111,7 @@ async def asyncio( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: GetModelsAllofResponse200 diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_oneof_with_required_const.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_oneof_with_required_const.py index 73911b7cd..24e29e82b 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_oneof_with_required_const.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_oneof_with_required_const.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -25,7 +25,7 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1 | None: if response.status_code == 200: @@ -57,7 +57,7 @@ def _parse_response_200( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1]: return Response( status_code=HTTPStatus(response.status_code), @@ -74,7 +74,7 @@ def sync_detailed( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1] @@ -96,7 +96,7 @@ def sync( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1 @@ -114,7 +114,7 @@ async def asyncio_detailed( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1] @@ -134,7 +134,7 @@ async def asyncio( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1 diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_common_parameters.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_common_parameters.py index 27509b93a..59dffd69e 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_common_parameters.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_common_parameters.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -28,7 +28,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -38,7 +38,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -58,7 +58,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -86,7 +86,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_types_unions_duplicate_types.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_types_unions_duplicate_types.py index f6eabc4a7..18ab41553 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_types_unions_duplicate_types.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_types_unions_duplicate_types.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -29,7 +29,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AModel | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> AModel | None: if response.status_code == 200: def _parse_response_200(data: object) -> AModel: @@ -49,7 +49,7 @@ def _parse_response_200(data: object) -> AModel: return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[AModel]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[AModel]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +69,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[AModel] @@ -97,7 +97,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: AModel @@ -120,7 +120,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[AModel] @@ -146,7 +146,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: AModel diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/reserved_parameters.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/reserved_parameters.py index 687473903..e5eb4b0bc 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/reserved_parameters.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/reserved_parameters.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -31,7 +31,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -41,7 +41,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -63,7 +63,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -94,7 +94,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/defaults/defaults_tests_defaults_post.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/defaults/defaults_tests_defaults_post.py index 9990c8b5e..b38047ffa 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/defaults/defaults_tests_defaults_post.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/defaults/defaults_tests_defaults_post.py @@ -2,7 +2,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -87,7 +87,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Any | HTTPValidationError | None: if response.status_code == 200: response_200 = response.json() @@ -105,7 +105,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[Any | HTTPValidationError]: return Response( status_code=HTTPStatus(response.status_code), @@ -151,7 +151,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any | HTTPValidationError] @@ -216,7 +216,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Any | HTTPValidationError @@ -276,7 +276,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any | HTTPValidationError] @@ -339,7 +339,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Any | HTTPValidationError diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/bool_enum_tests_bool_enum_post.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/bool_enum_tests_bool_enum_post.py index 53b574ebd..b1d18c7a7 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/bool_enum_tests_bool_enum_post.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/bool_enum_tests_bool_enum_post.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -28,7 +28,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -38,7 +38,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,7 +59,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -88,7 +88,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/int_enum_tests_int_enum_post.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/int_enum_tests_int_enum_post.py index 264c5af9e..a9c50eff3 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/int_enum_tests_int_enum_post.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/int_enum_tests_int_enum_post.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -30,7 +30,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -40,7 +40,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +61,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -90,7 +90,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_header_types.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_header_types.py index 20c2db527..bd4b7d30e 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_header_types.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_header_types.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -47,7 +47,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -57,7 +57,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -87,7 +87,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -130,7 +130,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_query_optionality.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_query_optionality.py index 756e4a266..92ecb0126 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_query_optionality.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_query_optionality.py @@ -2,7 +2,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -54,7 +54,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -64,7 +64,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -90,7 +90,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -127,7 +127,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/hyphen_in_path.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/hyphen_in_path.py index d30d3c1ae..03a1451ff 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/hyphen_in_path.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/hyphen_in_path.py @@ -2,7 +2,7 @@ from typing import Any from urllib.parse import quote -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -23,7 +23,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -33,7 +33,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -53,7 +53,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -81,7 +81,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/mixed_case.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/mixed_case.py index 5945ad0de..a45840f45 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/mixed_case.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/mixed_case.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -32,7 +32,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> MixedCaseResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> MixedCaseResponse200 | None: if response.status_code == 200: response_200 = MixedCaseResponse200.from_dict(response.json()) @@ -45,7 +45,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[MixedCaseResponse200]: return Response( status_code=HTTPStatus(response.status_code), @@ -68,7 +68,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[MixedCaseResponse200] @@ -99,7 +99,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: MixedCaseResponse200 @@ -125,7 +125,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[MixedCaseResponse200] @@ -154,7 +154,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: MixedCaseResponse200 diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/post_naming_property_conflict_with_import.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/post_naming_property_conflict_with_import.py index 9e848f7af..097346097 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/post_naming_property_conflict_with_import.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/post_naming_property_conflict_with_import.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -33,7 +33,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> PostNamingPropertyConflictWithImportResponse200 | None: if response.status_code == 200: response_200 = PostNamingPropertyConflictWithImportResponse200.from_dict(response.json()) @@ -47,7 +47,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[PostNamingPropertyConflictWithImportResponse200]: return Response( status_code=HTTPStatus(response.status_code), @@ -68,7 +68,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[PostNamingPropertyConflictWithImportResponse200] @@ -96,7 +96,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: PostNamingPropertyConflictWithImportResponse200 @@ -119,7 +119,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[PostNamingPropertyConflictWithImportResponse200] @@ -145,7 +145,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: PostNamingPropertyConflictWithImportResponse200 diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py index 801929db9..a5fbec07c 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py @@ -2,7 +2,7 @@ from typing import Any from urllib.parse import quote -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -46,7 +46,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -56,7 +56,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -85,7 +85,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -126,7 +126,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py index 23c5b72da..f6d28f607 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py @@ -2,7 +2,7 @@ from typing import Any from urllib.parse import quote -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -32,7 +32,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -42,7 +42,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +64,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -95,7 +95,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py index 3233fa605..87d43132a 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py @@ -2,7 +2,7 @@ from typing import Any from urllib.parse import quote -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -32,7 +32,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -42,7 +42,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +66,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -99,7 +99,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py index dd11f68ca..4399d04a5 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py @@ -2,7 +2,7 @@ from typing import Any from urllib.parse import quote -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -43,7 +43,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -53,7 +53,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,7 +79,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -116,7 +116,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/multiple_path_parameters.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/multiple_path_parameters.py index d683b856c..06d727608 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/multiple_path_parameters.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/multiple_path_parameters.py @@ -2,7 +2,7 @@ from typing import Any from urllib.parse import quote -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -29,7 +29,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -39,7 +39,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -65,7 +65,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -102,7 +102,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/default_status_code.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/default_status_code.py index aa32c5393..220bdc417 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/default_status_code.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/default_status_code.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response @@ -17,12 +17,12 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> str: response_default = response.text return response_default -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[str]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -39,7 +39,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[str] @@ -62,7 +62,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: str @@ -81,7 +81,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[str] @@ -102,7 +102,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: str diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py index 022f30062..ba8a64942 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -22,7 +22,7 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> PostResponsesUnionsSimpleBeforeComplexResponse200 | None: if response.status_code == 200: response_200 = PostResponsesUnionsSimpleBeforeComplexResponse200.from_dict(response.json()) @@ -36,7 +36,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[PostResponsesUnionsSimpleBeforeComplexResponse200]: return Response( status_code=HTTPStatus(response.status_code), @@ -54,7 +54,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[PostResponsesUnionsSimpleBeforeComplexResponse200] @@ -77,7 +77,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: PostResponsesUnionsSimpleBeforeComplexResponse200 @@ -96,7 +96,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[PostResponsesUnionsSimpleBeforeComplexResponse200] @@ -117,7 +117,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: PostResponsesUnionsSimpleBeforeComplexResponse200 diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/reference_response.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/reference_response.py index 77429a73b..1d5c6e119 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/reference_response.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/reference_response.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -19,7 +19,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AModel | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> AModel | None: if response.status_code == 200: response_200 = AModel.from_dict(response.json()) @@ -31,7 +31,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[AModel]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[AModel]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -48,7 +48,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[AModel] @@ -71,7 +71,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: AModel @@ -90,7 +90,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[AModel] @@ -111,7 +111,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: AModel diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_patterns.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_patterns.py index 796d3764f..094edac13 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_patterns.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_patterns.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -21,7 +21,7 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX | None: if 200 <= response.status_code <= 299: response_2xx = StatusCodePatternsResponse2XX.from_dict(response.json()) @@ -40,7 +40,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX]: return Response( status_code=HTTPStatus(response.status_code), @@ -58,7 +58,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX] @@ -81,7 +81,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX @@ -100,7 +100,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX] @@ -121,7 +121,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_precedence.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_precedence.py index 11d832c87..c836a8bf6 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_precedence.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_precedence.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response @@ -17,7 +17,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> str: if response.status_code == 200: response_200 = response.text return response_200 @@ -34,7 +34,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return response_default -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[str]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -53,7 +53,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[str] @@ -78,7 +78,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: str @@ -99,7 +99,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[str] @@ -122,7 +122,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: str diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/text_response.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/text_response.py index 0f56f8c77..f91776e62 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/text_response.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/text_response.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -18,7 +18,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> str | None: if response.status_code == 200: response_200 = response.text return response_200 @@ -29,7 +29,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[str]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -46,7 +46,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[str] @@ -69,7 +69,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: str @@ -88,7 +88,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[str] @@ -109,7 +109,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: str diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag1/get_tag_with_number.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag1/get_tag_with_number.py index 3ee534c8f..84438ceba 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag1/get_tag_with_number.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag1/get_tag_with_number.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -18,7 +18,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -28,7 +28,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -44,7 +44,7 @@ def sync_detailed( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -66,7 +66,7 @@ async def asyncio_detailed( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag2/get_tag_with_number.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag2/get_tag_with_number.py index 3ee534c8f..84438ceba 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag2/get_tag_with_number.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag2/get_tag_with_number.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -18,7 +18,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -28,7 +28,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -44,7 +44,7 @@ def sync_detailed( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -66,7 +66,7 @@ async def asyncio_detailed( """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/callback_test.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/callback_test.py index e806fe60c..2f3a83935 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/callback_test.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/callback_test.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -30,7 +30,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Any | HTTPValidationError | None: if response.status_code == 200: response_200 = response.json() @@ -48,7 +48,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[Any | HTTPValidationError]: return Response( status_code=HTTPStatus(response.status_code), @@ -72,7 +72,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any | HTTPValidationError] @@ -103,7 +103,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Any | HTTPValidationError @@ -129,7 +129,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any | HTTPValidationError] @@ -158,7 +158,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Any | HTTPValidationError diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/description_with_backslash.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/description_with_backslash.py index f173767ed..225311273 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/description_with_backslash.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/description_with_backslash.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -18,7 +18,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -28,7 +28,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -47,7 +47,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -72,7 +72,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_booleans.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_booleans.py index 0a20d2f8f..cb0000213 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_booleans.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_booleans.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any, cast -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -18,7 +18,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[bool] | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> list[bool] | None: if response.status_code == 200: response_200 = cast(list[bool], response.json()) @@ -30,7 +30,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[bool]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[list[bool]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -49,7 +49,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[list[bool]] @@ -74,7 +74,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: list[bool] @@ -95,7 +95,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[list[bool]] @@ -118,7 +118,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: list[bool] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_floats.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_floats.py index 0beb7b1dd..08ec7e33c 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_floats.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_floats.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any, cast -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -18,7 +18,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[float] | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> list[float] | None: if response.status_code == 200: response_200 = cast(list[float], response.json()) @@ -30,7 +30,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[float]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[list[float]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -49,7 +49,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[list[float]] @@ -74,7 +74,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: list[float] @@ -95,7 +95,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[list[float]] @@ -118,7 +118,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: list[float] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_integers.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_integers.py index c0ca1e8c7..b3553d133 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_integers.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_integers.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any, cast -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -18,7 +18,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[int] | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> list[int] | None: if response.status_code == 200: response_200 = cast(list[int], response.json()) @@ -30,7 +30,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[int]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[list[int]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -49,7 +49,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[list[int]] @@ -74,7 +74,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: list[int] @@ -95,7 +95,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[list[int]] @@ -118,7 +118,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: list[int] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_strings.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_strings.py index 4cb0a1bef..a87b9f8ee 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_strings.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_strings.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any, cast -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -18,7 +18,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[str] | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> list[str] | None: if response.status_code == 200: response_200 = cast(list[str], response.json()) @@ -30,7 +30,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[str]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[list[str]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -49,7 +49,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[list[str]] @@ -74,7 +74,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: list[str] @@ -95,7 +95,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[list[str]] @@ -118,7 +118,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: list[str] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_user_list.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_user_list.py index 5fcbd86e1..22afe9fc6 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_user_list.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_user_list.py @@ -2,7 +2,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -65,7 +65,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> HTTPValidationError | list[AModel] | None: if response.status_code == 200: response_200 = [] @@ -94,7 +94,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[HTTPValidationError | list[AModel]]: return Response( status_code=HTTPStatus(response.status_code), @@ -124,7 +124,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[HTTPValidationError | list[AModel]] @@ -164,7 +164,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: HTTPValidationError | list[AModel] @@ -199,7 +199,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[HTTPValidationError | list[AModel]] @@ -237,7 +237,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: HTTPValidationError | list[AModel] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/json_body_tests_json_body_post.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/json_body_tests_json_body_post.py index 5be950c77..75066a876 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/json_body_tests_json_body_post.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/json_body_tests_json_body_post.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -30,7 +30,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Any | HTTPValidationError | None: if response.status_code == 200: response_200 = response.json() @@ -48,7 +48,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[Any | HTTPValidationError]: return Response( status_code=HTTPStatus(response.status_code), @@ -72,7 +72,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any | HTTPValidationError] @@ -103,7 +103,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Any | HTTPValidationError @@ -129,7 +129,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any | HTTPValidationError] @@ -158,7 +158,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Any | HTTPValidationError diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/no_response_tests_no_response_get.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/no_response_tests_no_response_get.py index 34c4b54c0..2c7483093 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/no_response_tests_no_response_get.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/no_response_tests_no_response_get.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -18,7 +18,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -28,7 +28,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -45,7 +45,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -68,7 +68,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py index c08c3caca..cb80638b2 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py @@ -2,7 +2,7 @@ from io import BytesIO from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -19,7 +19,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> File | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> File | None: if response.status_code == 200: response_200 = File(payload=BytesIO(response.content)) @@ -31,7 +31,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[File]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[File]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -48,7 +48,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[File] @@ -71,7 +71,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: File @@ -90,7 +90,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[File] @@ -111,7 +111,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: File diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_post.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_post.py index 1dd936601..05de63067 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_post.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_post.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -30,7 +30,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200 | None: if response.status_code == 200: response_200 = OctetStreamTestsOctetStreamPostResponse200.from_dict(response.json()) @@ -49,7 +49,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200]: return Response( status_code=HTTPStatus(response.status_code), @@ -71,7 +71,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200] @@ -100,7 +100,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200 @@ -124,7 +124,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200] @@ -151,7 +151,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200 diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data.py index 5e1ba06ed..6a16a08ed 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -27,7 +27,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -37,7 +37,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,7 +60,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -91,7 +91,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data_inline.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data_inline.py index 168fd9c82..06591c97f 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data_inline.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data_inline.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -27,7 +27,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -37,7 +37,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,7 +60,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -91,7 +91,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_tests_json_body_string.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_tests_json_body_string.py index 498d0572e..76a715e00 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_tests_json_body_string.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_tests_json_body_string.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any, cast -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -29,7 +29,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> HTTPValidationError | str | None: if response.status_code == 200: response_200 = cast(str, response.json()) @@ -47,7 +47,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[HTTPValidationError | str]: return Response( status_code=HTTPStatus(response.status_code), @@ -69,7 +69,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[HTTPValidationError | str] @@ -98,7 +98,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: HTTPValidationError | str @@ -122,7 +122,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[HTTPValidationError | str] @@ -149,7 +149,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: HTTPValidationError | str diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/test_inline_objects.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/test_inline_objects.py index ea2e45c94..baf632f64 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/test_inline_objects.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/test_inline_objects.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -30,7 +30,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> TestInlineObjectsResponse200 | None: if response.status_code == 200: response_200 = TestInlineObjectsResponse200.from_dict(response.json()) @@ -44,7 +44,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[TestInlineObjectsResponse200]: return Response( status_code=HTTPStatus(response.status_code), @@ -66,7 +66,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[TestInlineObjectsResponse200] @@ -95,7 +95,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: TestInlineObjectsResponse200 @@ -119,7 +119,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[TestInlineObjectsResponse200] @@ -146,7 +146,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: TestInlineObjectsResponse200 diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py index 9ad310a2a..d97c6863d 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -25,7 +25,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -38,7 +38,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +61,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -92,7 +92,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py index 409f6147a..ada25d673 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -18,7 +18,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -28,7 +28,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -45,7 +45,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -68,7 +68,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/upload_file_tests_upload_post.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/upload_file_tests_upload_post.py index 6339d61f3..406b7c417 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/upload_file_tests_upload_post.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/upload_file_tests_upload_post.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -30,7 +30,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Any | HTTPValidationError | None: if response.status_code == 200: response_200 = response.json() @@ -48,7 +48,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[Any | HTTPValidationError]: return Response( status_code=HTTPStatus(response.status_code), @@ -72,7 +72,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any | HTTPValidationError] @@ -103,7 +103,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Any | HTTPValidationError @@ -129,7 +129,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any | HTTPValidationError] @@ -158,7 +158,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Any | HTTPValidationError diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/true_/false_.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/true_/false_.py index d7713f03f..8a00ad453 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/true_/false_.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/true_/false_.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -28,7 +28,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Any | None: if response.status_code == 200: return None @@ -38,7 +38,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -58,7 +58,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] @@ -86,7 +86,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Any] diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/client.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/client.py index edb246d7e..bdb085ef5 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/client.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/client.py @@ -1,7 +1,7 @@ import ssl from typing import Any, Self -import httpx +import httpx2 from attrs import define, evolve, field @@ -9,7 +9,7 @@ class Client: """A class for keeping track of data related to the API - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -18,14 +18,14 @@ class Client: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx2_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. Attributes: @@ -38,12 +38,12 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") - _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _httpx2_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx2_args") + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -61,7 +61,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "Client": + def with_timeout(self, timeout: httpx2.Timeout) -> "Client": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -69,66 +69,66 @@ def with_timeout(self, timeout: httpx.Timeout) -> "Client": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> Self: - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> Self: + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._client def __enter__(self) -> Self: - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self: - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._async_client async def __aenter__(self) -> Self: - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) @@ -136,7 +136,7 @@ async def __aexit__(self, *args: Any, **kwargs: Any) -> None: class AuthenticatedClient: """A Client which has been authenticated for use on secured endpoints - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -145,14 +145,14 @@ class AuthenticatedClient: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx2_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. Attributes: @@ -168,12 +168,12 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") - _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _httpx2_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx2_args") + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) token: str prefix: str = "Bearer" @@ -195,7 +195,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": + def with_timeout(self, timeout: httpx2.Timeout) -> "AuthenticatedClient": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -203,66 +203,66 @@ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> Self: - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> Self: + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._client def __enter__(self) -> Self: - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self: - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._async_client async def __aenter__(self) -> Self: - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/types.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/types.py index b64af0952..9090a2620 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/types.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/types.py @@ -14,7 +14,7 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() -# The types that `httpx.Client(files=)` can accept, copied from that library. +# The types that `httpx2.Client(files=)` can accept, copied from that library. FileContent = IO[bytes] | bytes | str FileTypes = ( # (filename, file (or bytes), content_type) @@ -34,7 +34,7 @@ class File: mime_type: str | None = None def to_tuple(self) -> FileTypes: - """Return a tuple representation that httpx will accept for multipart/form-data""" + """Return a tuple representation that httpx2 will accept for multipart/form-data""" return self.file_name, self.payload, self.mime_type diff --git a/end_to_end_tests/golden-records/my-test-api-client/pyproject.toml b/end_to_end_tests/golden-records/my-test-api-client/pyproject.toml index f2498ce1a..7906f7ea6 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/pyproject.toml +++ b/end_to_end_tests/golden-records/my-test-api-client/pyproject.toml @@ -11,8 +11,8 @@ include = ["my_test_api_client/py.typed"] [tool.poetry.dependencies] python = "^3.11" -httpx = ">=0.23.1,<0.29.0" -attrs = ">=22.2.0" +httpx2 = ">=2.13.1,<3" +attrs = ">=22.2.0" [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"] diff --git a/end_to_end_tests/golden-records/test-3-1-features-client/README.md b/end_to_end_tests/golden-records/test-3-1-features-client/README.md index 352824967..26c3f34c5 100644 --- a/end_to_end_tests/golden-records/test-3-1-features-client/README.md +++ b/end_to_end_tests/golden-records/test-3-1-features-client/README.md @@ -76,7 +76,7 @@ Things to know: ## Advanced customizations -There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case): +There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx2.Client` or `httpx2.AsyncClient` (depending on your use-case): ```python from test_3_1_features_client import Client @@ -90,23 +90,23 @@ def log_response(response): client = Client( base_url="https://api.example.com", - httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, + httpx2_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, ) -# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() +# Or get the underlying httpx2 client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() ``` -You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url): +You can even set the httpx2 client directly, but beware that this will override any existing settings (e.g., base_url): ```python -import httpx +import httpx2 from test_3_1_features_client import Client client = Client( base_url="https://api.example.com", ) # Note that base_url needs to be re-set, as would any shared cookies, headers, etc. -client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030")) +client.set_httpx_client(httpx2.Client(base_url="https://api.example.com", proxy="http://localhost:8030")) ``` ## Building / publishing this package diff --git a/end_to_end_tests/golden-records/test-3-1-features-client/pyproject.toml b/end_to_end_tests/golden-records/test-3-1-features-client/pyproject.toml index 39efe0b62..3bfc6f388 100644 --- a/end_to_end_tests/golden-records/test-3-1-features-client/pyproject.toml +++ b/end_to_end_tests/golden-records/test-3-1-features-client/pyproject.toml @@ -11,8 +11,8 @@ include = ["test_3_1_features_client/py.typed"] [tool.poetry.dependencies] python = "^3.11" -httpx = ">=0.23.1,<0.29.0" -attrs = ">=22.2.0" +httpx2 = ">=2.13.1,<3" +attrs = ">=22.2.0" [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"] diff --git a/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/const/post_const_path.py b/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/const/post_const_path.py index bf3472121..dcdf89e9d 100644 --- a/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/const/post_const_path.py +++ b/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/const/post_const_path.py @@ -2,7 +2,7 @@ from typing import Any, Literal, cast from urllib.parse import quote -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -44,7 +44,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Literal["Why have a fixed response? I dunno"] | None: if response.status_code == 200: response_200 = cast(Literal["Why have a fixed response? I dunno"], response.json()) @@ -61,7 +61,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[Literal["Why have a fixed response? I dunno"]]: return Response( status_code=HTTPStatus(response.status_code), @@ -88,7 +88,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Literal['Why have a fixed response? I dunno']] @@ -125,7 +125,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Literal['Why have a fixed response? I dunno'] @@ -157,7 +157,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[Literal['Why have a fixed response? I dunno']] @@ -192,7 +192,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Literal['Why have a fixed response? I dunno'] diff --git a/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/prefix_items/post_prefix_items.py b/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/prefix_items/post_prefix_items.py index 5b114873e..d20bd99ce 100644 --- a/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/prefix_items/post_prefix_items.py +++ b/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/prefix_items/post_prefix_items.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any, cast -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -28,7 +28,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> str | None: if response.status_code == 200: response_200 = cast(str, response.json()) return response_200 @@ -39,7 +39,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[str]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,7 +59,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[str] @@ -87,7 +87,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: str @@ -110,7 +110,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[str] @@ -136,7 +136,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: str diff --git a/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/client.py b/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/client.py index edb246d7e..bdb085ef5 100644 --- a/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/client.py +++ b/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/client.py @@ -1,7 +1,7 @@ import ssl from typing import Any, Self -import httpx +import httpx2 from attrs import define, evolve, field @@ -9,7 +9,7 @@ class Client: """A class for keeping track of data related to the API - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -18,14 +18,14 @@ class Client: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx2_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. Attributes: @@ -38,12 +38,12 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") - _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _httpx2_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx2_args") + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -61,7 +61,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "Client": + def with_timeout(self, timeout: httpx2.Timeout) -> "Client": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -69,66 +69,66 @@ def with_timeout(self, timeout: httpx.Timeout) -> "Client": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> Self: - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> Self: + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._client def __enter__(self) -> Self: - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self: - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._async_client async def __aenter__(self) -> Self: - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) @@ -136,7 +136,7 @@ async def __aexit__(self, *args: Any, **kwargs: Any) -> None: class AuthenticatedClient: """A Client which has been authenticated for use on secured endpoints - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -145,14 +145,14 @@ class AuthenticatedClient: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx2_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. Attributes: @@ -168,12 +168,12 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") - _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _httpx2_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx2_args") + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) token: str prefix: str = "Bearer" @@ -195,7 +195,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": + def with_timeout(self, timeout: httpx2.Timeout) -> "AuthenticatedClient": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -203,66 +203,66 @@ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> Self: - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> Self: + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._client def __enter__(self) -> Self: - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self: - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._async_client async def __aenter__(self) -> Self: - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) diff --git a/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/types.py b/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/types.py index b64af0952..9090a2620 100644 --- a/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/types.py +++ b/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/types.py @@ -14,7 +14,7 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() -# The types that `httpx.Client(files=)` can accept, copied from that library. +# The types that `httpx2.Client(files=)` can accept, copied from that library. FileContent = IO[bytes] | bytes | str FileTypes = ( # (filename, file (or bytes), content_type) @@ -34,7 +34,7 @@ class File: mime_type: str | None = None def to_tuple(self) -> FileTypes: - """Return a tuple representation that httpx will accept for multipart/form-data""" + """Return a tuple representation that httpx2 will accept for multipart/form-data""" return self.file_name, self.payload, self.mime_type diff --git a/end_to_end_tests/metadata_snapshots/pdm.pyproject.toml b/end_to_end_tests/metadata_snapshots/pdm.pyproject.toml index c5262ff1e..44be8e61e 100644 --- a/end_to_end_tests/metadata_snapshots/pdm.pyproject.toml +++ b/end_to_end_tests/metadata_snapshots/pdm.pyproject.toml @@ -6,7 +6,7 @@ authors = [] readme = "README.md" requires-python = ">=3.11" dependencies = [ - "httpx>=0.23.1,<0.29.0", + "httpx2>=2.13.1,<3", "attrs>=22.2.0", ] diff --git a/end_to_end_tests/metadata_snapshots/poetry.pyproject.toml b/end_to_end_tests/metadata_snapshots/poetry.pyproject.toml index 39efe0b62..3bfc6f388 100644 --- a/end_to_end_tests/metadata_snapshots/poetry.pyproject.toml +++ b/end_to_end_tests/metadata_snapshots/poetry.pyproject.toml @@ -11,8 +11,8 @@ include = ["test_3_1_features_client/py.typed"] [tool.poetry.dependencies] python = "^3.11" -httpx = ">=0.23.1,<0.29.0" -attrs = ">=22.2.0" +httpx2 = ">=2.13.1,<3" +attrs = ">=22.2.0" [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"] diff --git a/end_to_end_tests/metadata_snapshots/setup.py b/end_to_end_tests/metadata_snapshots/setup.py index 96e9030b5..066d707c3 100644 --- a/end_to_end_tests/metadata_snapshots/setup.py +++ b/end_to_end_tests/metadata_snapshots/setup.py @@ -13,6 +13,6 @@ long_description_content_type="text/markdown", packages=find_packages(), python_requires=">=3.11, <4", - install_requires=["httpx >= 0.23.1, < 0.29.0", "attrs >= 22.2.0"], + install_requires=["httpx2 >= 2.13.1, < 3", "attrs >= 22.2.0"], package_data={"test_3_1_features_client": ["py.typed"]}, ) diff --git a/end_to_end_tests/metadata_snapshots/uv.pyproject.toml b/end_to_end_tests/metadata_snapshots/uv.pyproject.toml index 553582723..f89ce4ee8 100644 --- a/end_to_end_tests/metadata_snapshots/uv.pyproject.toml +++ b/end_to_end_tests/metadata_snapshots/uv.pyproject.toml @@ -6,7 +6,7 @@ authors = [] requires-python = ">=3.11" readme = "README.md" dependencies = [ - "httpx>=0.23.1,<0.29.0", + "httpx2>=2.13.1,<3", "attrs>=22.2.0", ] diff --git a/integration-tests/README.md b/integration-tests/README.md index ec94ebc0a..0b24a16c2 100644 --- a/integration-tests/README.md +++ b/integration-tests/README.md @@ -56,11 +56,7 @@ client = AuthenticatedClient( You can also disable certificate validation altogether, but beware that **this is a security risk**. ```python -client = AuthenticatedClient( - base_url="https://internal_api.example.com", - token="SuperSecretToken", - verify_ssl=False -) +client = AuthenticatedClient(base_url="https://internal_api.example.com", token="SuperSecretToken", verify_ssl=False) ``` Things to know: @@ -76,36 +72,39 @@ Things to know: ## Advanced customizations -There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case): +There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx2.Client` or `httpx2.AsyncClient` (depending on your use-case): ```python from integration_tests import Client + def log_request(request): print(f"Request event hook: {request.method} {request.url} - Waiting for response") + def log_response(response): request = response.request print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}") + client = Client( base_url="https://api.example.com", - httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, + httpx2_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, ) -# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() +# Or get the underlying httpx2 client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() ``` -You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url): +You can even set the httpx2 client directly, but beware that this will override any existing settings (e.g., base_url): ```python -import httpx +import httpx2 from integration_tests import Client client = Client( base_url="https://api.example.com", ) # Note that base_url needs to be re-set, as would any shared cookies, headers, etc. -client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030")) +client.set_httpx_client(httpx2.Client(base_url="https://api.example.com", proxy="http://localhost:8030")) ``` diff --git a/integration-tests/integration_tests/api/body/post_body_multipart.py b/integration-tests/integration_tests/api/body/post_body_multipart.py index 7ceef67b6..9e1d19116 100644 --- a/integration-tests/integration_tests/api/body/post_body_multipart.py +++ b/integration-tests/integration_tests/api/body/post_body_multipart.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -32,7 +32,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> PostBodyMultipartResponse200 | PublicError | None: if response.status_code == 200: response_200 = PostBodyMultipartResponse200.from_dict(response.json()) @@ -51,7 +51,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[PostBodyMultipartResponse200 | PublicError]: return Response( status_code=HTTPStatus(response.status_code), @@ -72,7 +72,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[PostBodyMultipartResponse200 | PublicError] @@ -100,7 +100,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: PostBodyMultipartResponse200 | PublicError @@ -123,7 +123,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[PostBodyMultipartResponse200 | PublicError] @@ -149,7 +149,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: PostBodyMultipartResponse200 | PublicError diff --git a/integration-tests/integration_tests/api/parameters/post_parameters_header.py b/integration-tests/integration_tests/api/parameters/post_parameters_header.py index 190b7efe0..efda5aef5 100644 --- a/integration-tests/integration_tests/api/parameters/post_parameters_header.py +++ b/integration-tests/integration_tests/api/parameters/post_parameters_header.py @@ -1,7 +1,7 @@ from http import HTTPStatus from typing import Any -import httpx +import httpx2 from ... import errors from ...client import AuthenticatedClient, Client @@ -36,7 +36,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> PostParametersHeaderResponse200 | PublicError | None: if response.status_code == 200: response_200 = PostParametersHeaderResponse200.from_dict(response.json()) @@ -55,7 +55,7 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx2.Response ) -> Response[PostParametersHeaderResponse200 | PublicError]: return Response( status_code=HTTPStatus(response.status_code), @@ -82,7 +82,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[PostParametersHeaderResponse200 | PublicError] @@ -119,7 +119,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: PostParametersHeaderResponse200 | PublicError @@ -151,7 +151,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[PostParametersHeaderResponse200 | PublicError] @@ -186,7 +186,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: PostParametersHeaderResponse200 | PublicError diff --git a/integration-tests/integration_tests/client.py b/integration-tests/integration_tests/client.py index edb246d7e..bdb085ef5 100644 --- a/integration-tests/integration_tests/client.py +++ b/integration-tests/integration_tests/client.py @@ -1,7 +1,7 @@ import ssl from typing import Any, Self -import httpx +import httpx2 from attrs import define, evolve, field @@ -9,7 +9,7 @@ class Client: """A class for keeping track of data related to the API - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -18,14 +18,14 @@ class Client: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx2_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. Attributes: @@ -38,12 +38,12 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") - _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _httpx2_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx2_args") + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -61,7 +61,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "Client": + def with_timeout(self, timeout: httpx2.Timeout) -> "Client": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -69,66 +69,66 @@ def with_timeout(self, timeout: httpx.Timeout) -> "Client": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> Self: - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> Self: + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._client def __enter__(self) -> Self: - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self: - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._async_client async def __aenter__(self) -> Self: - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) @@ -136,7 +136,7 @@ async def __aexit__(self, *args: Any, **kwargs: Any) -> None: class AuthenticatedClient: """A Client which has been authenticated for use on secured endpoints - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -145,14 +145,14 @@ class AuthenticatedClient: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx2_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. Attributes: @@ -168,12 +168,12 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") - _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _httpx2_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx2_args") + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) token: str prefix: str = "Bearer" @@ -195,7 +195,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": + def with_timeout(self, timeout: httpx2.Timeout) -> "AuthenticatedClient": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -203,66 +203,66 @@ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> Self: - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> Self: + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._client def __enter__(self) -> Self: - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self: - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._async_client async def __aenter__(self) -> Self: - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) diff --git a/integration-tests/integration_tests/types.py b/integration-tests/integration_tests/types.py index b64af0952..9090a2620 100644 --- a/integration-tests/integration_tests/types.py +++ b/integration-tests/integration_tests/types.py @@ -14,7 +14,7 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() -# The types that `httpx.Client(files=)` can accept, copied from that library. +# The types that `httpx2.Client(files=)` can accept, copied from that library. FileContent = IO[bytes] | bytes | str FileTypes = ( # (filename, file (or bytes), content_type) @@ -34,7 +34,7 @@ class File: mime_type: str | None = None def to_tuple(self) -> FileTypes: - """Return a tuple representation that httpx will accept for multipart/form-data""" + """Return a tuple representation that httpx2 will accept for multipart/form-data""" return self.file_name, self.payload, self.mime_type diff --git a/integration-tests/pdm.lock b/integration-tests/pdm.lock index ffae47bd6..4d1402c22 100644 --- a/integration-tests/pdm.lock +++ b/integration-tests/pdm.lock @@ -4,8 +4,8 @@ [metadata] groups = ["default", "dev"] strategy = ["inherit_metadata"] -lock_version = "4.5.0" -content_hash = "sha256:eaf8c822d09eaa6cb6b1cb2ac7deb1746c24e404459a1a79f5c35df71b8883c7" +lock_version = "4.5.1" +content_hash = "sha256:eb4eb7e74795ab92e4c226931cb38597587e39a9745cf55963cbd45f65f60c70" [[metadata.targets]] requires_python = "~=3.11" @@ -16,6 +16,7 @@ version = "4.14.0" requires_python = ">=3.10" summary = "High-level concurrency and networking framework on top of asyncio or Trio" groups = ["default"] +marker = "sys_platform != \"emscripten\"" dependencies = [ "exceptiongroup>=1.0.2; python_version < \"3.11\"", "idna>=2.8", @@ -79,17 +80,6 @@ files = [ {file = "attrs-26.1.0.tar.gz", hash = "sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32"}, ] -[[package]] -name = "certifi" -version = "2026.6.17" -requires_python = ">=3.7" -summary = "Python package for providing Mozilla's CA Bundle." -groups = ["default"] -files = [ - {file = "certifi-2026.6.17-py3-none-any.whl", hash = "sha256:2227dcbaafe0d2f59279d1762ddddc37783ed4354594f194ffc31d20f41fc3db"}, - {file = "certifi-2026.6.17.tar.gz", hash = "sha256:024c88eeec92ca068db80f02b8b07c9cef7b9fe261d1d535abfd5abd6f6af432"}, -] - [[package]] name = "colorama" version = "0.4.6" @@ -108,41 +98,57 @@ version = "0.16.0" requires_python = ">=3.8" summary = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" groups = ["default"] +marker = "sys_platform != \"emscripten\"" files = [ {file = "h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"}, {file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"}, ] [[package]] -name = "httpcore" -version = "1.0.9" -requires_python = ">=3.8" +name = "httpcore2" +version = "2.16.0" +requires_python = ">=3.11" summary = "A minimal low-level HTTP client." groups = ["default"] +marker = "sys_platform != \"emscripten\"" dependencies = [ - "certifi", "h11>=0.16", + "truststore>=0.10", ] files = [ - {file = "httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55"}, - {file = "httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8"}, + {file = "httpcore2-2.16.0-py3-none-any.whl", hash = "sha256:5c4358319f2602d984ad93182c9fee5160f22e9da7babdda870a5e7c4e2dc34f"}, + {file = "httpcore2-2.16.0.tar.gz", hash = "sha256:c72cd0413563b17e1cd8354677dff887466f8ec2551679759e93126534428643"}, ] [[package]] -name = "httpx" -version = "0.28.1" -requires_python = ">=3.8" +name = "httpx2" +version = "2.16.0" +requires_python = ">=3.11" summary = "The next generation HTTP client." groups = ["default"] dependencies = [ - "anyio", - "certifi", - "httpcore==1.*", - "idna", + "anyio>=4.10; sys_platform != \"emscripten\"", + "httpcore2==2.16.0; sys_platform != \"emscripten\"", + "httpx2-jsfetch; sys_platform == \"emscripten\" and python_version >= \"3.12\"", + "idna>=3.18", + "truststore>=0.10; sys_platform != \"emscripten\"", + "typing-extensions>=4.5.0; python_version < \"3.13\"", ] files = [ - {file = "httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"}, - {file = "httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc"}, + {file = "httpx2-2.16.0-py3-none-any.whl", hash = "sha256:fd2c5d7909e8d86fe92d53020c310ca0e4e431b838c207c5754b9bbf0308d49a"}, + {file = "httpx2-2.16.0.tar.gz", hash = "sha256:0d54c98128e8f2ff7fbbde0fca8c359e5f032edeaaaac443cdb7f31f685bcd7f"}, +] + +[[package]] +name = "httpx2-jsfetch" +version = "1.0" +requires_python = ">=3.12" +summary = "httpx2 transports for Emscripten/Pyodide, backed by the JavaScript fetch API." +groups = ["default"] +marker = "sys_platform == \"emscripten\" and python_version >= \"3.12\"" +files = [ + {file = "httpx2_jsfetch-1.0-py3-none-any.whl", hash = "sha256:cb916b707601e69a07721aabc8f3f6659be3a6893bc1ff5c6f9e02241df2da32"}, + {file = "httpx2_jsfetch-1.0.tar.gz", hash = "sha256:70a0e3eabfef7cce5ad9c629f7d01ca05e418f586646f4ddf14782e4c1454c60"}, ] [[package]] @@ -389,6 +395,18 @@ files = [ {file = "pytest_asyncio-1.4.0.tar.gz", hash = "sha256:c6c0d2259945122819f171a32ecea2c349ead889ee28176caaf492143424be42"}, ] +[[package]] +name = "truststore" +version = "0.10.5" +requires_python = ">=3.10" +summary = "Verify certificates using native system trust stores" +groups = ["default"] +marker = "sys_platform != \"emscripten\"" +files = [ + {file = "truststore-0.10.5-py3-none-any.whl", hash = "sha256:9aaaedaefaf06d8b206278cf8b5012bc897f485a874503501e12d776df78951c"}, + {file = "truststore-0.10.5.tar.gz", hash = "sha256:30d36967ccaded5cbb38d602c433f53600036c79d502f4533a49b60a03bbefcd"}, +] + [[package]] name = "typing-extensions" version = "4.15.0" diff --git a/integration-tests/pdm.minimal.lock b/integration-tests/pdm.minimal.lock index 52a719b9f..9838d01d1 100644 --- a/integration-tests/pdm.minimal.lock +++ b/integration-tests/pdm.minimal.lock @@ -4,8 +4,8 @@ [metadata] groups = ["default", "dev"] strategy = ["direct_minimal_versions", "inherit_metadata"] -lock_version = "4.5.0" -content_hash = "sha256:eaf8c822d09eaa6cb6b1cb2ac7deb1746c24e404459a1a79f5c35df71b8883c7" +lock_version = "4.5.1" +content_hash = "sha256:eb4eb7e74795ab92e4c226931cb38597587e39a9745cf55963cbd45f65f60c70" [[metadata.targets]] requires_python = "~=3.11" @@ -16,6 +16,7 @@ version = "4.13.0" requires_python = ">=3.10" summary = "High-level concurrency and networking framework on top of asyncio or Trio" groups = ["default"] +marker = "sys_platform != \"emscripten\"" dependencies = [ "exceptiongroup>=1.0.2; python_version < \"3.11\"", "idna>=2.8", @@ -37,17 +38,6 @@ files = [ {file = "attrs-22.2.0.tar.gz", hash = "sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99"}, ] -[[package]] -name = "certifi" -version = "2026.5.20" -requires_python = ">=3.7" -summary = "Python package for providing Mozilla's CA Bundle." -groups = ["default"] -files = [ - {file = "certifi-2026.5.20-py3-none-any.whl", hash = "sha256:3c52e209ba0a4ad7aebe60436a4ab349c39e1e602e8c134221e546902ad25897"}, - {file = "certifi-2026.5.20.tar.gz", hash = "sha256:69dea482ab64caa7b9f6aba1c6bf48bb6a5448d1c0f1b17ab42ad8c763a5344d"}, -] - [[package]] name = "colorama" version = "0.4.6" @@ -62,61 +52,72 @@ files = [ [[package]] name = "h11" -version = "0.14.0" -requires_python = ">=3.7" +version = "0.16.0" +requires_python = ">=3.8" summary = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" groups = ["default"] -dependencies = [ - "typing-extensions; python_version < \"3.8\"", -] +marker = "sys_platform != \"emscripten\"" files = [ - {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"}, - {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, + {file = "h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"}, + {file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"}, ] [[package]] -name = "httpcore" -version = "0.16.3" -requires_python = ">=3.7" +name = "httpcore2" +version = "2.13.1" +requires_python = ">=3.10" summary = "A minimal low-level HTTP client." groups = ["default"] +marker = "sys_platform != \"emscripten\"" dependencies = [ - "anyio<5.0,>=3.0", - "certifi", - "h11<0.15,>=0.13", - "sniffio==1.*", + "h11>=0.16", + "truststore>=0.10", ] files = [ - {file = "httpcore-0.16.3-py3-none-any.whl", hash = "sha256:da1fb708784a938aa084bde4feb8317056c55037247c787bd7e19eb2c2949dc0"}, - {file = "httpcore-0.16.3.tar.gz", hash = "sha256:c5d6f04e2fc530f39e0c077e6a30caa53f1451096120f1f38b954afd0b17c0cb"}, + {file = "httpcore2-2.13.1-py3-none-any.whl", hash = "sha256:e1e05d4f25f7d7d496bfb96748f6f4b67657b03da069b3a68c36069f3db73d0a"}, + {file = "httpcore2-2.13.1.tar.gz", hash = "sha256:e0aa977abe17e69a3b820a24542a6fa88702676d83880b8d194dcd18408e5103"}, ] [[package]] -name = "httpx" -version = "0.23.1" -requires_python = ">=3.7" +name = "httpx2" +version = "2.13.1" +requires_python = ">=3.10" summary = "The next generation HTTP client." groups = ["default"] dependencies = [ - "certifi", - "httpcore<0.17.0,>=0.15.0", - "rfc3986[idna2008]<2,>=1.3", - "sniffio", + "anyio>=4.10; sys_platform != \"emscripten\"", + "httpcore2==2.13.1; sys_platform != \"emscripten\"", + "httpx2-jsfetch; sys_platform == \"emscripten\" and python_version >= \"3.12\"", + "idna>=3.18", + "truststore>=0.10; sys_platform != \"emscripten\"", + "typing-extensions>=4.5.0; python_version < \"3.13\"", ] files = [ - {file = "httpx-0.23.1-py3-none-any.whl", hash = "sha256:0b9b1f0ee18b9978d637b0776bfd7f54e2ca278e063e3586d8f01cda89e042a8"}, - {file = "httpx-0.23.1.tar.gz", hash = "sha256:202ae15319be24efe9a8bd4ed4360e68fde7b38bcc2ce87088d416f026667d19"}, + {file = "httpx2-2.13.1-py3-none-any.whl", hash = "sha256:6dff50fabc270ee5fd25d845d0b078ed20564579744d6d962850975996d2f9a4"}, + {file = "httpx2-2.13.1.tar.gz", hash = "sha256:e48744a19e3af5ee48313d0ce5fe941d5422fae5705ea922a4aabf94d7800dfa"}, +] + +[[package]] +name = "httpx2-jsfetch" +version = "1.0" +requires_python = ">=3.12" +summary = "httpx2 transports for Emscripten/Pyodide, backed by the JavaScript fetch API." +groups = ["default"] +marker = "sys_platform == \"emscripten\" and python_version >= \"3.12\"" +files = [ + {file = "httpx2_jsfetch-1.0-py3-none-any.whl", hash = "sha256:cb916b707601e69a07721aabc8f3f6659be3a6893bc1ff5c6f9e02241df2da32"}, + {file = "httpx2_jsfetch-1.0.tar.gz", hash = "sha256:70a0e3eabfef7cce5ad9c629f7d01ca05e418f586646f4ddf14782e4c1454c60"}, ] [[package]] name = "idna" -version = "3.17" +version = "3.20" requires_python = ">=3.9" summary = "Internationalized Domain Names in Applications (IDNA)" groups = ["default"] files = [ - {file = "idna-3.17-py3-none-any.whl", hash = "sha256:466e48829084efe2548012b855df21540b96f2e20e51bd124c851536556a592c"}, - {file = "idna-3.17.tar.gz", hash = "sha256:5eb0cb53bc467c12eadcf6de83163ad8527cec9416f44b9b61b19caedad2b87f"}, + {file = "idna-3.20-py3-none-any.whl", hash = "sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c"}, + {file = "idna-3.20.tar.gz", hash = "sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44"}, ] [[package]] @@ -228,39 +229,15 @@ files = [ ] [[package]] -name = "rfc3986" -version = "1.5.0" -summary = "Validating URI References per RFC 3986" -groups = ["default"] -files = [ - {file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"}, - {file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"}, -] - -[[package]] -name = "rfc3986" -version = "1.5.0" -extras = ["idna2008"] -summary = "Validating URI References per RFC 3986" -groups = ["default"] -dependencies = [ - "idna", - "rfc3986==1.5.0", -] -files = [ - {file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"}, - {file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"}, -] - -[[package]] -name = "sniffio" -version = "1.3.1" -requires_python = ">=3.7" -summary = "Sniff out which async library your code is running under" +name = "truststore" +version = "0.10.5" +requires_python = ">=3.10" +summary = "Verify certificates using native system trust stores" groups = ["default"] +marker = "sys_platform != \"emscripten\"" files = [ - {file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"}, - {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"}, + {file = "truststore-0.10.5-py3-none-any.whl", hash = "sha256:9aaaedaefaf06d8b206278cf8b5012bc897f485a874503501e12d776df78951c"}, + {file = "truststore-0.10.5.tar.gz", hash = "sha256:30d36967ccaded5cbb38d602c433f53600036c79d502f4533a49b60a03bbefcd"}, ] [[package]] diff --git a/integration-tests/pyproject.toml b/integration-tests/pyproject.toml index 0811b4b42..591a62dc9 100644 --- a/integration-tests/pyproject.toml +++ b/integration-tests/pyproject.toml @@ -6,7 +6,7 @@ authors = [] readme = "README.md" requires-python = ">=3.11,<4.0" dependencies = [ - "httpx>=0.23.1,<0.29.0", + "httpx2>=2.13.1,<3", "attrs>=22.2.0", ] diff --git a/integration-tests/tests/test_api/test_body/test_post_body_multipart.py b/integration-tests/tests/test_api/test_body/test_post_body_multipart.py index fbb87a1d0..ff685a1c7 100644 --- a/integration-tests/tests/test_api/test_body/test_post_body_multipart.py +++ b/integration-tests/tests/test_api/test_body/test_post_body_multipart.py @@ -79,7 +79,7 @@ def log_response(*_: Any, **__: Any) -> None: response_hook_called = True client = Client( - "http://localhost:3000", httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}} + "http://localhost:3000", httpx2_args={"event_hooks": {"request": [log_request], "response": [log_response]}} ) post_body_multipart.sync_detailed( diff --git a/openapi_python_client/__init__.py b/openapi_python_client/__init__.py index c3b766338..dc7892ba8 100644 --- a/openapi_python_client/__init__.py +++ b/openapi_python_client/__init__.py @@ -10,8 +10,8 @@ from subprocess import CalledProcessError from typing import Any -import httpcore -import httpx +import httpcore2 +import httpx2 from jinja2 import BaseLoader, ChoiceLoader, Environment, FileSystemLoader, PackageLoader from ruamel.yaml import YAML from ruamel.yaml.error import YAMLError @@ -355,14 +355,14 @@ def _get_document(*, source: str | Path, timeout: int) -> dict[str, Any] | Gener content_type: str | None if isinstance(source, str): try: - response = httpx.get(source, timeout=timeout) + response = httpx2.get(source, timeout=timeout) yaml_bytes = response.content if "content-type" in response.headers: content_type = response.headers["content-type"].split(";")[0] else: # pragma: no cover content_type = mimetypes.guess_type(source, strict=True)[0] - except (httpx.HTTPError, httpcore.NetworkError): + except (httpx2.HTTPError, httpcore2.NetworkError): return GeneratorError(header="Could not get OpenAPI document from provided URL") else: yaml_bytes = source.read_bytes() diff --git a/openapi_python_client/parser/responses.py b/openapi_python_client/parser/responses.py index ef1c212a8..60311aae1 100644 --- a/openapi_python_client/parser/responses.py +++ b/openapi_python_client/parser/responses.py @@ -31,7 +31,7 @@ def __len__(self) -> int: class _ResponseSource(TypedDict): - """What data should be pulled from the httpx Response object""" + """What data should be pulled from the httpx2 Response object""" attribute: str return_type: str diff --git a/openapi_python_client/templates/README.md.jinja b/openapi_python_client/templates/README.md.jinja index d4b60f303..61132dab0 100644 --- a/openapi_python_client/templates/README.md.jinja +++ b/openapi_python_client/templates/README.md.jinja @@ -76,7 +76,7 @@ Things to know: ## Advanced customizations -There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case): +There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx2.Client` or `httpx2.AsyncClient` (depending on your use-case): ```python from {{ package_name }} import Client @@ -90,23 +90,23 @@ def log_response(response): client = Client( base_url="https://api.example.com", - httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, + httpx2_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, ) -# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() +# Or get the underlying httpx2 client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() ``` -You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url): +You can even set the httpx2 client directly, but beware that this will override any existing settings (e.g., base_url): ```python -import httpx +import httpx2 from {{ package_name }} import Client client = Client( base_url="https://api.example.com", ) # Note that base_url needs to be re-set, as would any shared cookies, headers, etc. -client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030")) +client.set_httpx_client(httpx2.Client(base_url="https://api.example.com", proxy="http://localhost:8030")) ``` {% if meta == "poetry" %} @@ -136,4 +136,4 @@ If you want to install this client into another project without publishing it (e 1. If that project is not using uv: 1. Build a wheel with `uv build --wheel`. 1. Install that wheel from the other project `pip install `. -{% endif %} \ No newline at end of file +{% endif %} diff --git a/openapi_python_client/templates/client.py.jinja b/openapi_python_client/templates/client.py.jinja index a8c4ac5c1..a4d105f65 100644 --- a/openapi_python_client/templates/client.py.jinja +++ b/openapi_python_client/templates/client.py.jinja @@ -2,7 +2,7 @@ import ssl from typing import Any, Self from attrs import define, field, evolve -import httpx +import httpx2 {% set attrs_info = { @@ -34,8 +34,8 @@ import httpx class Client: """A class for keeping track of data related to the API -{% macro httpx_args_docstring() %} - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: +{% macro httpx2_args_docstring() %} + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -44,16 +44,16 @@ class Client: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx2_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. {% endmacro %} -{{ httpx_args_docstring() }} +{{ httpx2_args_docstring() }} {% if not config.docstrings_on_attributes %} Attributes: @@ -65,12 +65,12 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") - _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _httpx2_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx2_args") + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) {% endmacro %}{{ attributes() }} {% macro builders(self) %} def with_headers(self, headers: dict[str, str]) -> "{{ self }}": @@ -89,7 +89,7 @@ class Client: self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "{{ self }}": + def with_timeout(self, timeout: httpx2.Timeout) -> "{{ self }}": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -97,81 +97,81 @@ class Client: self._async_client.timeout = timeout return evolve(self, timeout=timeout) {% endmacro %}{{ builders("Client") }} -{% macro httpx_stuff(name, custom_constructor=None) %} - def set_httpx_client(self, client: httpx.Client) -> Self: - """Manually set the underlying httpx.Client +{% macro httpx2_stuff(name, custom_constructor=None) %} + def set_httpx_client(self, client: httpx2.Client) -> Self: + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: {% if custom_constructor %} {{ custom_constructor | indent(12) }} {% endif %} - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._client def __enter__(self) -> Self: - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self: - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: {% if custom_constructor %} {{ custom_constructor | indent(12) }} {% endif %} - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, timeout=self._timeout, verify=self._verify_ssl, follow_redirects=self._follow_redirects, - **self._httpx_args, + **self._httpx2_args, ) return self._async_client async def __aenter__(self) -> Self: - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) -{% endmacro %}{{ httpx_stuff("Client") }} +{% endmacro %}{{ httpx2_stuff("Client") }} @define class AuthenticatedClient: """A Client which has been authenticated for use on secured endpoints -{{ httpx_args_docstring() }} +{{ httpx2_args_docstring() }} {% if not config.docstrings_on_attributes %} Attributes: @@ -188,4 +188,4 @@ class AuthenticatedClient: {{ declare_attr("auth_header_name") | indent(4) }} {{ builders("AuthenticatedClient") }} -{{ httpx_stuff("AuthenticatedClient", "self._headers[self.auth_header_name] = f\"{self.prefix} {self.token}\" if self.prefix else self.token") }} +{{ httpx2_stuff("AuthenticatedClient", "self._headers[self.auth_header_name] = f\"{self.prefix} {self.token}\" if self.prefix else self.token") }} diff --git a/openapi_python_client/templates/endpoint_macros.py.jinja b/openapi_python_client/templates/endpoint_macros.py.jinja index 493c3551c..8c35bba07 100644 --- a/openapi_python_client/templates/endpoint_macros.py.jinja +++ b/openapi_python_client/templates/endpoint_macros.py.jinja @@ -184,7 +184,7 @@ Args: {% endif %} Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: {% if is_detailed %} diff --git a/openapi_python_client/templates/endpoint_module.py.jinja b/openapi_python_client/templates/endpoint_module.py.jinja index 97f30a2b8..7c6f8894b 100644 --- a/openapi_python_client/templates/endpoint_module.py.jinja +++ b/openapi_python_client/templates/endpoint_module.py.jinja @@ -2,7 +2,7 @@ from http import HTTPStatus from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET @@ -78,7 +78,7 @@ def _get_kwargs( {% endif %} -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> {{return_type}}: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> {{return_type}}: {% for response in endpoint.responses.patterns %} {% set code_range = response.status_code.range %} {% if code_range[0] == code_range[1] %} @@ -98,7 +98,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res {% endif %} -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[{{ return_string | as_unembedded_code }}]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[{{ return_string | as_unembedded_code }}]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, diff --git a/openapi_python_client/templates/pyproject_pdm.toml.jinja b/openapi_python_client/templates/pyproject_pdm.toml.jinja index e3f664f08..c3cea3b08 100644 --- a/openapi_python_client/templates/pyproject_pdm.toml.jinja +++ b/openapi_python_client/templates/pyproject_pdm.toml.jinja @@ -6,7 +6,7 @@ authors = [] readme = "README.md" requires-python = ">=3.11" dependencies = [ - "httpx>=0.23.1,<0.29.0", + "httpx2>=2.13.1,<3", "attrs>=22.2.0", ] diff --git a/openapi_python_client/templates/pyproject_poetry.toml.jinja b/openapi_python_client/templates/pyproject_poetry.toml.jinja index 8dc24f621..ced705185 100644 --- a/openapi_python_client/templates/pyproject_poetry.toml.jinja +++ b/openapi_python_client/templates/pyproject_poetry.toml.jinja @@ -11,8 +11,8 @@ include = ["{{ package_name }}/py.typed"] [tool.poetry.dependencies] python = "^3.11" -httpx = ">=0.23.1,<0.29.0" -attrs = ">=22.2.0" +httpx2 = ">=2.13.1,<3" +attrs = ">=22.2.0" [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"] diff --git a/openapi_python_client/templates/pyproject_uv.toml.jinja b/openapi_python_client/templates/pyproject_uv.toml.jinja index c56e203d8..917dc0f5c 100644 --- a/openapi_python_client/templates/pyproject_uv.toml.jinja +++ b/openapi_python_client/templates/pyproject_uv.toml.jinja @@ -6,7 +6,7 @@ authors = [] requires-python = ">=3.11" readme = "README.md" dependencies = [ - "httpx>=0.23.1,<0.29.0", + "httpx2>=2.13.1,<3", "attrs>=22.2.0", ] diff --git a/openapi_python_client/templates/setup.py.jinja b/openapi_python_client/templates/setup.py.jinja index c6e355205..255629213 100644 --- a/openapi_python_client/templates/setup.py.jinja +++ b/openapi_python_client/templates/setup.py.jinja @@ -13,6 +13,6 @@ setup( long_description_content_type="text/markdown", packages=find_packages(), python_requires=">=3.11, <4", - install_requires=["httpx >= 0.23.1, < 0.29.0", "attrs >= 22.2.0"], + install_requires=["httpx2 >= 2.13.1, < 3", "attrs >= 22.2.0"], package_data={"{{ package_name }}": ["py.typed"]}, ) diff --git a/openapi_python_client/templates/types.py.jinja b/openapi_python_client/templates/types.py.jinja index f74db0ad7..2047c19c1 100644 --- a/openapi_python_client/templates/types.py.jinja +++ b/openapi_python_client/templates/types.py.jinja @@ -14,7 +14,7 @@ class Unset: UNSET: Unset = Unset() -# The types that `httpx.Client(files=)` can accept, copied from that library. +# The types that `httpx2.Client(files=)` can accept, copied from that library. FileContent = IO[bytes] | bytes | str FileTypes = ( # (filename, file (or bytes), content_type) @@ -33,7 +33,7 @@ class File: mime_type: str | None = None def to_tuple(self) -> FileTypes: - """ Return a tuple representation that httpx will accept for multipart/form-data """ + """ Return a tuple representation that httpx2 will accept for multipart/form-data """ return self.file_name, self.payload, self.mime_type diff --git a/pdm.lock b/pdm.lock index 4311788d7..f25266e06 100644 --- a/pdm.lock +++ b/pdm.lock @@ -4,8 +4,8 @@ [metadata] groups = ["default", "dev"] strategy = ["inherit_metadata"] -lock_version = "4.5.0" -content_hash = "sha256:175e4c79af4623cfe2ff416ec1f952a29b9e4dc783133f62fa873455512ea5ca" +lock_version = "4.5.1" +content_hash = "sha256:3f2cdaeaaba92e437f591efd1c94f8594fe6992c3c780a0c5c0c1bdfec4a4594" [[metadata.targets]] requires_python = "~=3.11" @@ -41,6 +41,7 @@ version = "4.14.0" requires_python = ">=3.10" summary = "High-level concurrency and networking framework on top of asyncio or Trio" groups = ["default"] +marker = "sys_platform != \"emscripten\"" dependencies = [ "exceptiongroup>=1.0.2; python_version < \"3.11\"", "idna>=2.8", @@ -104,17 +105,6 @@ files = [ {file = "attrs-26.1.0.tar.gz", hash = "sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32"}, ] -[[package]] -name = "certifi" -version = "2026.6.17" -requires_python = ">=3.7" -summary = "Python package for providing Mozilla's CA Bundle." -groups = ["default"] -files = [ - {file = "certifi-2026.6.17-py3-none-any.whl", hash = "sha256:2227dcbaafe0d2f59279d1762ddddc37783ed4354594f194ffc31d20f41fc3db"}, - {file = "certifi-2026.6.17.tar.gz", hash = "sha256:024c88eeec92ca068db80f02b8b07c9cef7b9fe261d1d535abfd5abd6f6af432"}, -] - [[package]] name = "colorama" version = "0.4.6" @@ -310,41 +300,57 @@ version = "0.16.0" requires_python = ">=3.8" summary = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" groups = ["default"] +marker = "sys_platform != \"emscripten\"" files = [ {file = "h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"}, {file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"}, ] [[package]] -name = "httpcore" -version = "1.0.9" -requires_python = ">=3.8" +name = "httpcore2" +version = "2.16.0" +requires_python = ">=3.11" summary = "A minimal low-level HTTP client." groups = ["default"] +marker = "sys_platform != \"emscripten\"" dependencies = [ - "certifi", "h11>=0.16", + "truststore>=0.10", ] files = [ - {file = "httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55"}, - {file = "httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8"}, + {file = "httpcore2-2.16.0-py3-none-any.whl", hash = "sha256:5c4358319f2602d984ad93182c9fee5160f22e9da7babdda870a5e7c4e2dc34f"}, + {file = "httpcore2-2.16.0.tar.gz", hash = "sha256:c72cd0413563b17e1cd8354677dff887466f8ec2551679759e93126534428643"}, ] [[package]] -name = "httpx" -version = "0.28.1" -requires_python = ">=3.8" +name = "httpx2" +version = "2.16.0" +requires_python = ">=3.11" summary = "The next generation HTTP client." groups = ["default"] dependencies = [ - "anyio", - "certifi", - "httpcore==1.*", - "idna", + "anyio>=4.10; sys_platform != \"emscripten\"", + "httpcore2==2.16.0; sys_platform != \"emscripten\"", + "httpx2-jsfetch; sys_platform == \"emscripten\" and python_version >= \"3.12\"", + "idna>=3.18", + "truststore>=0.10; sys_platform != \"emscripten\"", + "typing-extensions>=4.5.0; python_version < \"3.13\"", ] files = [ - {file = "httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"}, - {file = "httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc"}, + {file = "httpx2-2.16.0-py3-none-any.whl", hash = "sha256:fd2c5d7909e8d86fe92d53020c310ca0e4e431b838c207c5754b9bbf0308d49a"}, + {file = "httpx2-2.16.0.tar.gz", hash = "sha256:0d54c98128e8f2ff7fbbde0fca8c359e5f032edeaaaac443cdb7f31f685bcd7f"}, +] + +[[package]] +name = "httpx2-jsfetch" +version = "1.0" +requires_python = ">=3.12" +summary = "httpx2 transports for Emscripten/Pyodide, backed by the JavaScript fetch API." +groups = ["default"] +marker = "sys_platform == \"emscripten\" and python_version >= \"3.12\"" +files = [ + {file = "httpx2_jsfetch-1.0-py3-none-any.whl", hash = "sha256:cb916b707601e69a07721aabc8f3f6659be3a6893bc1ff5c6f9e02241df2da32"}, + {file = "httpx2_jsfetch-1.0.tar.gz", hash = "sha256:70a0e3eabfef7cce5ad9c629f7d01ca05e418f586646f4ddf14782e4c1454c60"}, ] [[package]] @@ -1019,6 +1025,18 @@ files = [ {file = "syrupy-5.3.2.tar.gz", hash = "sha256:d4c9d4badb165a5694dcd869812717d899a8aa0b6f14f842437cb57c4ce09b3a"}, ] +[[package]] +name = "truststore" +version = "0.10.5" +requires_python = ">=3.10" +summary = "Verify certificates using native system trust stores" +groups = ["default"] +marker = "sys_platform != \"emscripten\"" +files = [ + {file = "truststore-0.10.5-py3-none-any.whl", hash = "sha256:9aaaedaefaf06d8b206278cf8b5012bc897f485a874503501e12d776df78951c"}, + {file = "truststore-0.10.5.tar.gz", hash = "sha256:30d36967ccaded5cbb38d602c433f53600036c79d502f4533a49b60a03bbefcd"}, +] + [[package]] name = "typer" version = "0.27.0" diff --git a/pdm.minimal.lock b/pdm.minimal.lock index ee5d2ee21..a564311f5 100644 --- a/pdm.minimal.lock +++ b/pdm.minimal.lock @@ -4,8 +4,8 @@ [metadata] groups = ["default", "dev"] strategy = ["direct_minimal_versions", "inherit_metadata"] -lock_version = "4.5.0" -content_hash = "sha256:175e4c79af4623cfe2ff416ec1f952a29b9e4dc783133f62fa873455512ea5ca" +lock_version = "4.5.1" +content_hash = "sha256:3f2cdaeaaba92e437f591efd1c94f8594fe6992c3c780a0c5c0c1bdfec4a4594" [[metadata.targets]] requires_python = "~=3.11" @@ -27,6 +27,7 @@ version = "4.14.2" requires_python = ">=3.10" summary = "High-level concurrency and networking framework on top of asyncio or Trio" groups = ["default"] +marker = "sys_platform != \"emscripten\"" dependencies = [ "exceptiongroup>=1.0.2; python_version < \"3.11\"", "idna>=2.8", @@ -48,17 +49,6 @@ files = [ {file = "attrs-22.2.0.tar.gz", hash = "sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99"}, ] -[[package]] -name = "certifi" -version = "2026.7.22" -requires_python = ">=3.7" -summary = "Python package for providing Mozilla's CA Bundle." -groups = ["default"] -files = [ - {file = "certifi-2026.7.22-py3-none-any.whl", hash = "sha256:62f22742b58a1a33014a2b6b706588a8d7e2a88ae7bd1a6ebe8c992928483775"}, - {file = "certifi-2026.7.22.tar.gz", hash = "sha256:741e2c3b351ddf169a738da9f2c048608ff7f2c5cc02f1ebc6b118bb090d5d55"}, -] - [[package]] name = "click" version = "8.4.2" @@ -214,50 +204,61 @@ files = [ [[package]] name = "h11" -version = "0.14.0" -requires_python = ">=3.7" +version = "0.16.0" +requires_python = ">=3.8" summary = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" groups = ["default"] -dependencies = [ - "typing-extensions; python_version < \"3.8\"", -] +marker = "sys_platform != \"emscripten\"" files = [ - {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"}, - {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, + {file = "h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"}, + {file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"}, ] [[package]] -name = "httpcore" -version = "0.16.3" -requires_python = ">=3.7" +name = "httpcore2" +version = "2.13.1" +requires_python = ">=3.10" summary = "A minimal low-level HTTP client." groups = ["default"] +marker = "sys_platform != \"emscripten\"" dependencies = [ - "anyio<5.0,>=3.0", - "certifi", - "h11<0.15,>=0.13", - "sniffio==1.*", + "h11>=0.16", + "truststore>=0.10", ] files = [ - {file = "httpcore-0.16.3-py3-none-any.whl", hash = "sha256:da1fb708784a938aa084bde4feb8317056c55037247c787bd7e19eb2c2949dc0"}, - {file = "httpcore-0.16.3.tar.gz", hash = "sha256:c5d6f04e2fc530f39e0c077e6a30caa53f1451096120f1f38b954afd0b17c0cb"}, + {file = "httpcore2-2.13.1-py3-none-any.whl", hash = "sha256:e1e05d4f25f7d7d496bfb96748f6f4b67657b03da069b3a68c36069f3db73d0a"}, + {file = "httpcore2-2.13.1.tar.gz", hash = "sha256:e0aa977abe17e69a3b820a24542a6fa88702676d83880b8d194dcd18408e5103"}, ] [[package]] -name = "httpx" -version = "0.23.1" -requires_python = ">=3.7" +name = "httpx2" +version = "2.13.1" +requires_python = ">=3.10" summary = "The next generation HTTP client." groups = ["default"] dependencies = [ - "certifi", - "httpcore<0.17.0,>=0.15.0", - "rfc3986[idna2008]<2,>=1.3", - "sniffio", + "anyio>=4.10; sys_platform != \"emscripten\"", + "httpcore2==2.13.1; sys_platform != \"emscripten\"", + "httpx2-jsfetch; sys_platform == \"emscripten\" and python_version >= \"3.12\"", + "idna>=3.18", + "truststore>=0.10; sys_platform != \"emscripten\"", + "typing-extensions>=4.5.0; python_version < \"3.13\"", ] files = [ - {file = "httpx-0.23.1-py3-none-any.whl", hash = "sha256:0b9b1f0ee18b9978d637b0776bfd7f54e2ca278e063e3586d8f01cda89e042a8"}, - {file = "httpx-0.23.1.tar.gz", hash = "sha256:202ae15319be24efe9a8bd4ed4360e68fde7b38bcc2ce87088d416f026667d19"}, + {file = "httpx2-2.13.1-py3-none-any.whl", hash = "sha256:6dff50fabc270ee5fd25d845d0b078ed20564579744d6d962850975996d2f9a4"}, + {file = "httpx2-2.13.1.tar.gz", hash = "sha256:e48744a19e3af5ee48313d0ce5fe941d5422fae5705ea922a4aabf94d7800dfa"}, +] + +[[package]] +name = "httpx2-jsfetch" +version = "1.0" +requires_python = ">=3.12" +summary = "httpx2 transports for Emscripten/Pyodide, backed by the JavaScript fetch API." +groups = ["default"] +marker = "sys_platform == \"emscripten\" and python_version >= \"3.12\"" +files = [ + {file = "httpx2_jsfetch-1.0-py3-none-any.whl", hash = "sha256:cb916b707601e69a07721aabc8f3f6659be3a6893bc1ff5c6f9e02241df2da32"}, + {file = "httpx2_jsfetch-1.0.tar.gz", hash = "sha256:70a0e3eabfef7cce5ad9c629f7d01ca05e418f586646f4ddf14782e4c1454c60"}, ] [[package]] @@ -641,31 +642,6 @@ files = [ {file = "python-multipart-0.0.1.tar.gz", hash = "sha256:ae940d053341378e53937d6e7f2081d26b4435dbd53dcd901be73ef3d6ff70be"}, ] -[[package]] -name = "rfc3986" -version = "1.5.0" -summary = "Validating URI References per RFC 3986" -groups = ["default"] -files = [ - {file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"}, - {file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"}, -] - -[[package]] -name = "rfc3986" -version = "1.5.0" -extras = ["idna2008"] -summary = "Validating URI References per RFC 3986" -groups = ["default"] -dependencies = [ - "idna", - "rfc3986==1.5.0", -] -files = [ - {file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"}, - {file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"}, -] - [[package]] name = "rich" version = "15.0.0" @@ -783,17 +759,6 @@ files = [ {file = "shellingham-1.3.2.tar.gz", hash = "sha256:576c1982bea0ba82fb46c36feb951319d7f42214a82634233f58b40d858a751e"}, ] -[[package]] -name = "sniffio" -version = "1.3.1" -requires_python = ">=3.7" -summary = "Sniff out which async library your code is running under" -groups = ["default"] -files = [ - {file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"}, - {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"}, -] - [[package]] name = "sortedcontainers" version = "2.4.0" @@ -818,6 +783,18 @@ files = [ {file = "syrupy-4.6.1.tar.gz", hash = "sha256:37a835c9ce7857eeef86d62145885e10b3cb9615bc6abeb4ce404b3f18e1bb36"}, ] +[[package]] +name = "truststore" +version = "0.10.5" +requires_python = ">=3.10" +summary = "Verify certificates using native system trust stores" +groups = ["default"] +marker = "sys_platform != \"emscripten\"" +files = [ + {file = "truststore-0.10.5-py3-none-any.whl", hash = "sha256:9aaaedaefaf06d8b206278cf8b5012bc897f485a874503501e12d776df78951c"}, + {file = "truststore-0.10.5.tar.gz", hash = "sha256:30d36967ccaded5cbb38d602c433f53600036c79d502f4533a49b60a03bbefcd"}, +] + [[package]] name = "typer" version = "0.16.1" diff --git a/pyproject.toml b/pyproject.toml index 91d4bf1fb..115737743 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ dependencies = [ "shellingham>=1.3.2,<2.0.0", "pydantic>=2.10,<3.0.0", "attrs>=22.2.0", - "httpx>=0.23.1,<0.29.0", + "httpx2>=2.13.1,<3", "ruamel.yaml>=0.18.6,<0.20.0", "ruff>=0.2", ]