Skip to main content

pathapi-httpx

Version Python versions License: MIT Docs CI

The httpx HTTP transports for pathapi. pathapi.http sends requests with a transport built on the standard library, and from an event loop with that transport on worker threads. Install this distribution and HTTPClient sends through an httpx.Client, and AsyncHTTPClient through an httpx.AsyncClient on the caller's loop, with nothing to configure. It is documented at https://jose-pr.github.io/pathapi-httpx/.

Features

You want Built-in transports These transports
Requests from an event loop without a worker thread per request No: ThreadedTransport runs the standard-library transport on threads Yes: AsyncHttpxTransport
HTTP/2 No Yes: HttpxTransport(http2=True) with httpx[http2]
Your own httpx.Client or httpx.AsyncClient: mounted transports, limits, proxies, auth No Yes: HttpxTransport(client)
SSL_CERT_FILE, SSL_CERT_DIR and the certifi bundle The system trust store, or an ssl_context= Yes
Proxies from the environment, proxy= and mounts= http:// proxies through a provider Yes, as httpx does them
  • Credentials belong to one server. The auth of a client is sent to the server of the first request and to no other, and the clients of pathapi.http never take an Authorization header to another server on a redirect.
  • Exactly the headers it is given. A client's default headers and cookies are not added: HTTPClient and AsyncHTTPClient own the headers of a request.
  • No third-party text in an error. A failure of httpx is a TimeoutError, ConnectionError, ssl.SSLError, ValueError or OSError(EIO); what the library says, which can quote a URL, is never passed on.
  • The same promises as the built-in transports. The tests pathapi runs over its own transports run over these (python -m pathapi.http.testing --http-transports httpx --http-async-transports httpx).

Installation

pip install pathapi-httpx

Requires pathapi and httpx, which pip installs with it. HTTP/2 needs pip install "httpx[http2]".

Quick start

Send through an httpx.Client from threads or a script:

import httpx
from pathapi.http import HTTPClient
from pathapi_httpx import HttpxTransport

with httpx.Client() as session:
    with HTTPClient(HttpxTransport(session), timeout=(3, 30)) as client:
        reply = client.request("GET", "http://files.example.org/reports/today.txt")
        print(reply.read().decode())

The httpx.Client stays yours: neither the client nor the transport closes it.

Send from an event loop with httpx.AsyncClient on that loop:

import asyncio

from pathapi.http import AsyncHTTPClient
from pathapi_httpx import AsyncHttpxTransport


async def main():
    async with AsyncHttpxTransport() as transport:
        async with AsyncHTTPClient(transport) as client:
            replies = await asyncio.gather(
                *(
                    client.request("GET", f"http://files.example.org/reports/{day}.txt")
                    for day in ("mon", "tue", "wed")
                )
            )
            print([len(await reply.read()) for reply in replies])


asyncio.run(main())

Choose them for the whole process. PATHAPI_HTTP_TRANSPORT=httpx and PATHAPI_HTTP_ASYNC_TRANSPORT=httpx make every HTTPClient and AsyncHTTPClient that was given no transport send through a new httpx client:

PATHAPI_HTTP_ASYNC_TRANSPORT=httpx python -c "from pathapi.http import AsyncHTTPClient; print(type(AsyncHTTPClient().transport))"

API overview

Name Purpose
pathapi_httpx.HttpxTransport The transport: send() and close() over an httpx.Client
pathapi_httpx.AsyncHttpxTransport The async transport: await send() and await aclose() over an httpx.AsyncClient
pathapi_httpx.__version__ The installed version

pathapi.http finds the classes through the httpx entries of its pathapi.http_transports and pathapi.http_async_transports entry-point groups, which this distribution declares. The reference is in the API header that ships with the package.

Development

python -m venv .venv/3.14-posix-x86_64
.venv/3.14-posix-x86_64/bin/python -m pip install -e ".[dev]"
.venv/3.14-posix-x86_64/bin/python -m pytest -q -rs

pathapi 0.1.2 is a dependency; while it is not on PyPI, install it editable from its checkout first (pip install -e ../pathapi). The test run includes python -m pathapi.http.testing --http-transports httpx --http-async-transports httpx, the tests pathapi runs over its own transports.

Releasing

This project follows Semantic Versioning and keeps a CHANGELOG.md. Pushing a tag matching v* triggers the release workflow: test gate → build (checking the tag names the version built) → a strict docs build as a gate → GitHub release → publish. The release workflow never deploys the docs site itself: for a final release its last job dispatches the docs workflow at the tag, which owns every Pages deploy.

License

MIT — see LICENSE.

Metadata

Release files for pathapi-httpx 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pathapi-httpx 0.1.0
File Size Uploaded
pathapi_httpx-0.1.0.tar.gz 23.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pathapi-httpx 0.1.0
File Interpreter ABI Platform
pathapi_httpx-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 41.1 kB

Release files / pathapi_httpx-0.1.0.tar.gz

Download URL pathapi_httpx-0.1.0.tar.gz
Size 23.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9d7eedb5980529498b3f417622960f00f281211ac1b4072e495c5925aa012d1d
BLAKE2b-256 checksum
How to use checksums
c1a47dc1450552d58c5fede5d3e5d379b87d2d5d9d667e4c7131798b3bd0f60f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / pathapi_httpx-0.1.0-py3-none-any.whl

Download URL pathapi_httpx-0.1.0-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afdc9f7a79fbcd3f6c9972b1f1612b3f8ad8cad292fd35fc16f96db55ba52a14
BLAKE2b-256 checksum
How to use checksums
4b9d91b214e997f4974efb35911a491433e12d1233a97724c8ecdf485d6f7728
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page