Initial Commit

This commit is contained in:
Mark Gregory
2026-10-21 13:04:35 +01:00
commit 2c86cd435c
4963 changed files with 779038 additions and 0 deletions
@@ -0,0 +1,230 @@
Metadata-Version: 2.5
Name: httpx2
Version: 2.16.0
Summary: The next generation HTTP client.
Project-URL: Changelog, https://github.com/pydantic/httpx2/blob/main/src/httpx2/CHANGELOG.md
Project-URL: Homepage, https://github.com/pydantic/httpx2
Project-URL: Source, https://github.com/pydantic/httpx2
Author-email: Tom Christie <tom@tomchristie.com>
Maintainer-email: "Pydantic Services Inc." <engineering@pydantic.dev>
License-Expression: BSD-3-Clause
License-File: LICENSE.md
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: AnyIO
Classifier: Framework :: AsyncIO
Classifier: Framework :: Trio
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.11
Requires-Dist: anyio>=4.10; sys_platform != 'emscripten'
Requires-Dist: httpcore2==2.16.0; sys_platform != 'emscripten'
Requires-Dist: httpx2-jsfetch; sys_platform == 'emscripten' and python_version >= '3.12'
Requires-Dist: idna>=3.18
Requires-Dist: truststore>=0.10; sys_platform != 'emscripten'
Requires-Dist: typing-extensions>=4.5.0; python_version < '3.13'
Provides-Extra: brotli
Requires-Dist: brotli>=1.2.0; (platform_python_implementation == 'CPython') and extra == 'brotli'
Requires-Dist: brotlicffi>=1.2.0.2; (platform_python_implementation != 'CPython') and extra == 'brotli'
Provides-Extra: cli
Requires-Dist: click>=8.4.2; extra == 'cli'
Requires-Dist: pygments==2.*; extra == 'cli'
Requires-Dist: rich<16,>=10; extra == 'cli'
Provides-Extra: http2
Requires-Dist: h2<5,>=3; extra == 'http2'
Provides-Extra: socks
Requires-Dist: socksio==1.*; extra == 'socks'
Provides-Extra: ws
Requires-Dist: wsproto>=1.2; extra == 'ws'
Provides-Extra: zstd
Requires-Dist: backports-zstd>=1.0.0; (python_version <= '3.13') and extra == 'zstd'
Description-Content-Type: text/markdown
<h1 align="center">HTTPX2</h1>
<p align="center"><em>A next-generation HTTP client for Python.</em></p>
<p align="center">
<a href="https://github.com/pydantic/httpx2/actions"><img src="https://github.com/pydantic/httpx2/workflows/Test%20Suite/badge.svg" alt="Test Suite"></a>
<a href="https://pypi.org/project/httpx2/"><img src="https://badge.fury.io/py/httpx2.svg" alt="Package version"></a>
<a href="https://pydantic.dev/docs/logfire/join-slack/"><img src="https://img.shields.io/badge/Slack-Join%20Slack-4A154B?logo=slack" alt="Join Slack"></a>
</p>
HTTPX2 is a fully featured HTTP client library for Python. It includes **an integrated command line client**, has support for both **HTTP/1.1 and HTTP/2**, and provides both **sync and async APIs**.
> [!NOTE]
> HTTPX2 is a continuation of the wonderful work started by [@lovelydinosaur](https://github.com/lovelydinosaur) and the broader HTTPX community. We're enormously grateful for everything that has gone into HTTPX over the years - it has been a foundational piece of the modern Python ecosystem, and this project would not exist without it.
>
> With HTTPX itself seeing limited activity recently, Pydantic is picking up stewardship under the HTTPX2 name so that users have a reliably maintained path forward - including timely security updates for a library that sits in the critical path of so many production systems. Our aim is to honour the original project's design, keep it stable for everyone relying on it, and continue evolving it carefully. Thank you to [@lovelydinosaur](https://github.com/lovelydinosaur) and every past contributor for laying such a strong foundation. 💙
---
Install HTTPX2 using pip:
```shell
pip install httpx2
```
Now, let's get started:
```pycon
>>> import httpx2
>>> r = httpx2.get('https://www.example.org/')
>>> r
<Response [200 OK]>
>>> r.status_code
200
>>> r.headers['content-type']
'text/html; charset=UTF-8'
>>> r.text
'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'
```
Or, using the command-line client.
```shell
pip install 'httpx2[cli]' # The command line client is an optional dependency.
```
Which now allows us to use HTTPX2 directly from the command-line:
```shell
httpx2 --help
```
## Features
HTTPX2 builds on the well-established usability of `requests`, and gives you:
* A broadly [requests-compatible API](https://pydantic.dev/docs/httpx2/guides/compatibility/).
* An integrated command-line client.
* HTTP/1.1 [and HTTP/2 support](https://pydantic.dev/docs/httpx2/guides/http2/).
* Standard synchronous interface, but with [async support if you need it](https://pydantic.dev/docs/httpx2/guides/async/).
* Ability to make requests directly to [WSGI applications](https://pydantic.dev/docs/httpx2/advanced/transports/#wsgi-transport) or [ASGI applications](https://pydantic.dev/docs/httpx2/advanced/transports/#asgi-transport).
* Strict timeouts everywhere.
* Fully type annotated.
* 100% test coverage.
Plus all the standard features of `requests`...
* International Domains and URLs
* Keep-Alive & Connection Pooling
* Sessions with Cookie Persistence
* Browser-style SSL Verification
* Basic/Digest Authentication
* Elegant Key/Value Cookies
* Automatic Decompression
* Automatic Content Decoding
* Unicode Response Bodies
* Multipart File Uploads
* HTTP(S) Proxy Support
* Connection Timeouts
* Streaming Downloads
* .netrc Support
* Chunked Requests
## Installation
Install with pip:
```shell
pip install httpx2
```
Or, to include the optional HTTP/2 support, use:
```shell
pip install httpx2[http2]
```
## Documentation
Project documentation is available at [https://pydantic.dev/docs/httpx2/](https://pydantic.dev/docs/httpx2/).
For a run-through of all the basics, head over to the [QuickStart](https://pydantic.dev/docs/httpx2/get-started/quickstart/).
For more advanced topics, see the [Advanced Usage](https://pydantic.dev/docs/httpx2/advanced/clients/) section, the [async support](https://pydantic.dev/docs/httpx2/guides/async/) section, or the [HTTP/2](https://pydantic.dev/docs/httpx2/guides/http2/) section.
The [Developer Interface](https://pydantic.dev/docs/httpx2/api/api/) provides a comprehensive API reference.
To find out about tools that integrate with HTTPX, see [Third Party Packages](https://pydantic.dev/docs/httpx2/community/third_party_packages/).
## Observability with Pydantic Logfire
Install Logfire with HTTPX instrumentation support:
```shell
pip install 'logfire[httpx]'
```
HTTPX2 works out of the box with [Pydantic Logfire](https://pydantic.dev/logfire), our observability platform built on OpenTelemetry. One line instruments every request, giving you traces, timings, and status codes with no other changes:
```python
import logfire
import httpx2
logfire.configure()
logfire.instrument_httpx()
httpx2.get("https://pydantic.dev/")
```
This works the same way for explicit `httpx2.Client()` and `httpx2.AsyncClient()` instances, and you can scope instrumentation to a single client by passing it in: `logfire.instrument_httpx(client)`. Pass `capture_all=True` to also record headers and bodies. See the [Logfire HTTPX docs](https://logfire.pydantic.dev/docs/integrations/http-clients/httpx/) for the full set of options.
## Contribute
If you want to contribute with HTTPX2 check out the [Contributing Guide](https://pydantic.dev/docs/httpx2/community/contributing/) to learn how to start.
## Dependencies
The HTTPX2 project relies on these excellent libraries:
* `httpcore2` - The underlying transport implementation for `httpx2`.
* `h11` - HTTP/1.1 support.
* `anyio` - Structured concurrency primitives, used to support both `asyncio` and `trio`.
* `truststore` - SSL verification using the operating system's trust store.
* `idna` - Internationalized domain name support.
As well as these optional installs:
* `h2` - HTTP/2 support. *(Optional, with `httpx2[http2]`)*
* `socksio` - SOCKS proxy support. *(Optional, with `httpx2[socks]`)*
* `rich` - Rich terminal support. *(Optional, with `httpx2[cli]`)*
* `click` - Command line client support. *(Optional, with `httpx2[cli]`)*
* `brotli` or `brotlicffi` - Decoding for "brotli" compressed responses. *(Optional, with `httpx2[brotli]`)*
* `backports.zstd` - Decoding for "zstd" compressed responses on Python 3.13 and below. *(Optional, with `httpx2[zstd]`. On Python 3.14+, `zstd` is supported via the stdlib [`compression.zstd`](https://docs.python.org/3/library/compression.zstd.html) module when it is available, and the `httpx2[zstd]` extra installs nothing.)*
A huge amount of credit is due to `requests` for the API layout that
much of this work follows, as well as to `urllib3` for plenty of design
inspiration around the lower-level networking details.
---
<p align="center"><i>HTTPX2 is <a href="https://github.com/pydantic/httpx2/blob/main/LICENSE.md">BSD licensed</a> code.<br/>Designed & crafted with care.</i><br/>&mdash; 🦋 &mdash;</p>
## Release Information
## 2.16.0 (October 21st, 2026)
### Changed
* Look up only the cookie domains that match the request host, and skip the expired cookie sweep until a cookie is due. With 1,000 cookies across 500 domains, building the `Cookie` header is about 18 times faster. Cookies from different domains are now sent from the least to the most specific domain.
([#1285](https://github.com/pydantic/httpx2/pull/1285))
### Fixed
* Reuse the client cookie jar instead of copying it on every request and redirect. A custom policy set with `client.cookies.jar.set_policy()` now applies to outgoing requests.
([#1284](https://github.com/pydantic/httpx2/pull/1284))
---
[Full changelog](https://github.com/pydantic/httpx2/blob/main/src/httpx2/CHANGELOG.md)
@@ -0,0 +1,70 @@
../../../bin/httpx2,sha256=UhCiYZ1QbUJ-WvrbSLT8gr3hzXNC0BdDcqaF4RQTlgs,256
httpx2-2.16.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
httpx2-2.16.0.dist-info/METADATA,sha256=GS8gBGIA_1CRGnJ4wh377h4aTG-nlDInr-kjHSje_D8,10019
httpx2-2.16.0.dist-info/RECORD,,
httpx2-2.16.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
httpx2-2.16.0.dist-info/entry_points.txt,sha256=3uiZorRQlQAFNoHaDxuMsmkdjt3rUTmuBz81tLXFdQY,45
httpx2-2.16.0.dist-info/licenses/LICENSE.md,sha256=fn1tuvf-Fg05_W6E_QLDPKuWvL6jTTaZjVRbzrShnDA,1589
httpx2/__init__.py,sha256=BfjyqGaJJhHp5NsWDrQ7GJUjqr1zGXNoqV3vb5eUozo,2661
httpx2/__pycache__/__init__.cpython-311.pyc,,
httpx2/__pycache__/__version__.cpython-311.pyc,,
httpx2/__pycache__/_alias.cpython-311.pyc,,
httpx2/__pycache__/_api.cpython-311.pyc,,
httpx2/__pycache__/_auth.cpython-311.pyc,,
httpx2/__pycache__/_client.cpython-311.pyc,,
httpx2/__pycache__/_config.cpython-311.pyc,,
httpx2/__pycache__/_content.cpython-311.pyc,,
httpx2/__pycache__/_cookies.cpython-311.pyc,,
httpx2/__pycache__/_decoders.cpython-311.pyc,,
httpx2/__pycache__/_exceptions.cpython-311.pyc,,
httpx2/__pycache__/_main.cpython-311.pyc,,
httpx2/__pycache__/_models.cpython-311.pyc,,
httpx2/__pycache__/_multipart.cpython-311.pyc,,
httpx2/__pycache__/_sse.cpython-311.pyc,,
httpx2/__pycache__/_status_codes.cpython-311.pyc,,
httpx2/__pycache__/_types.cpython-311.pyc,,
httpx2/__pycache__/_urlparse.cpython-311.pyc,,
httpx2/__pycache__/_urls.cpython-311.pyc,,
httpx2/__pycache__/_utils.cpython-311.pyc,,
httpx2/__version__.py,sha256=XWKDNx4TZNJGkuO6vv16RvfV8lhdgdMIbQ8Bt0cR4UQ,158
httpx2/_alias.py,sha256=Evn6S3BWugzd5XgDAYOsQf45_tAQpgae4JJ6U6n02Bw,2431
httpx2/_api.py,sha256=IhvMLaySB7-pEER2l_qCbSDjTmG28hVPXIJJMdiHze0,14794
httpx2/_auth.py,sha256=VUO3zJfK3GGOp3dnQqYrAu6Lkip-DpK2mutFPmVbjjA,11969
httpx2/_client.py,sha256=pDgPmEKjiJZDBhhnPM72ZIalzb1mU5h9WBuGnHLfm1M,75349
httpx2/_config.py,sha256=DAJBDxmJX4GmlCqtNE1L1dgEr5sBmo8tvLcn48R2oTA,7438
httpx2/_content.py,sha256=sNp9IVai11gXO_4P5Uka8XqrT_A8Ab5xkgRlKD4xeY0,8490
httpx2/_cookies.py,sha256=lMivxsZyHM5zBJHim6WVPJ5QBKeAW79pHh5jDtTl5_0,2965
httpx2/_decoders.py,sha256=C479GSHULT-xFz3Rr5TwZ0uUn2ih_afezn7QcgoIfAA,15046
httpx2/_exceptions.py,sha256=69TPZgHvTkkjV1P0y5DSVOmDkxwCRsKhCfhd_qTTaVc,8857
httpx2/_main.py,sha256=JT_VdROzHpKs8DNBIvXZXF2jYr6jxo0NVyk1FK6ff5A,15434
httpx2/_models.py,sha256=INk4VXTudl3jGI34fJJKknUmfF_dwzNuqerCiPo9T6k,45856
httpx2/_multipart.py,sha256=ksgIJarALvO7EcgDmc40GX6GyVO6XG0faszehXdRaTg,10018
httpx2/_sse.py,sha256=IZ1Lf6NrgoZa7FP5-n_VhKhk0eEYFkPZtOC8g5JpQCk,7552
httpx2/_status_codes.py,sha256=0CWpuD1dw8PYrt9f7epZ0bZZQEnmqe-z6FK_IzIeh14,6625
httpx2/_transports/__init__.py,sha256=e65w9X4RMK9O_0Q6kPqpXr1ijeEf6b9xbl4KfrAYDCI,711
httpx2/_transports/__pycache__/__init__.cpython-311.pyc,,
httpx2/_transports/__pycache__/asgi.cpython-311.pyc,,
httpx2/_transports/__pycache__/base.cpython-311.pyc,,
httpx2/_transports/__pycache__/default.cpython-311.pyc,,
httpx2/_transports/__pycache__/mock.cpython-311.pyc,,
httpx2/_transports/__pycache__/wsgi.cpython-311.pyc,,
httpx2/_transports/asgi.py,sha256=PWe4gtw8l2NqK5VusB4uprs6l46fJ4ewLX8FUEOozuk,5429
httpx2/_transports/base.py,sha256=KY5zBVbdG6ge2sE-j0ZKyJ1C1LWBZVHQnOg0BdQ6idE,2584
httpx2/_transports/default.py,sha256=j8Q6KILUca_3UTZqfyjpHF4xgxpLKao7tOZpMaIUjpc,13913
httpx2/_transports/mock.py,sha256=3LZowN_YXbXezA2P4D4g29bCemTiT5Gr8U_vBvxtgxs,1209
httpx2/_transports/wsgi.py,sha256=R5UApE_xXvl3BwKMgokN5irXiXGRFbOrtTdiKXFEBkI,4904
httpx2/_types.py,sha256=pVETNjBR2OoWs9-sY7tRTAQM8sZx8-kNwZ4DjZcEYZU,2671
httpx2/_urlparse.py,sha256=X-_rLDsC9QMIGc1FXr9DVRTYsLLB_SOdaCOtF2-DRIA,18323
httpx2/_urls.py,sha256=t2wZOCuWtmP8vHnwq2hLhLZ_g2Y36K3SMpU0u_3J8CY,23184
httpx2/_utils.py,sha256=-2nvGVPvYfJxZXPU-RbQXxGazILdRp5kJUJK98mF5R4,10524
httpx2/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
httpx2/websockets/__init__.py,sha256=K66d2Zczl0Ewa0ey0Q2ETx5utzVH6n5G6J22mR3GbV0,1826
httpx2/websockets/__pycache__/__init__.cpython-311.pyc,,
httpx2/websockets/__pycache__/_api.cpython-311.pyc,,
httpx2/websockets/__pycache__/_exceptions.cpython-311.pyc,,
httpx2/websockets/__pycache__/_ping.cpython-311.pyc,,
httpx2/websockets/__pycache__/_transport.cpython-311.pyc,,
httpx2/websockets/_api.py,sha256=pNdsYOmhqeq5k8_DrtXK-w5QDAcKEq1FNwgBWF3j0Gc,63283
httpx2/websockets/_exceptions.py,sha256=bpnBX9fDdkWh9jKWqqXAcQ_jsIPDRSuzUexxz_RPzqA,1290
httpx2/websockets/_ping.py,sha256=M6Xmbap01-ldl1ejejmkjJbBgK1ulBj-_oaUoKciqrM,1258
httpx2/websockets/_transport.py,sha256=pGtJcgy58Vi9246bj56yr-80qqpfUk6FapMFd8zw2Ls,11029
@@ -0,0 +1,4 @@
Wheel-Version: 1.0
Generator: hatchling 1.32.4
Root-Is-Purelib: true
Tag: py3-none-any
@@ -0,0 +1,2 @@
[console_scripts]
httpx2 = httpx2._main:main
@@ -0,0 +1,13 @@
Copyright © 2026 to present Pydantic Services Inc. and individual contributors.
Copyright © 2019, [Encode OSS Ltd](https://www.encode.io/).
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.