Skip to main content

pathapi-requests

Version Python versions License: MIT Docs CI

The requests HTTP transport for pathapi. pathapi.http sends requests with a transport built on the standard library; install this distribution and the same HTTPClient sends through a requests.Session instead, with nothing to configure. It is for what the built-in transport does not do, and it is documented at https://jose-pr.github.io/pathapi-requests/.

Features

You want Built-in transport This transport
Your own requests.Session: mounted adapters, session.auth, cookies, hooks No Yes: HTTPClient(RequestsTransport(session))
~/.netrc credentials No Yes
REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE and the certifi bundle The system trust store, or an ssl_context= Yes
SOCKS proxies (socks5h://...) No: only http:// proxies Yes, with the socks extra
Digest authentication, or any other requests auth class No Through session.auth
A proxy provider indexed with the URL Yes Yes: RequestsTransport(proxies=provider)
  • Credentials belong to one server. What the session holds for authentication is sent to the server of the first request and to no other, and HTTPClient never takes an Authorization header to another server on a redirect.
  • No third-party text in an error. A failure of requests is a TimeoutError, ConnectionError, ssl.SSLError, ValueError or OSError(EIO); what the library says, which can quote a proxy URL with credentials, is never passed on.
  • The same promises as the built-in transport. The tests pathapi runs over its own transport run over this one (python -m pathapi.http.testing --http-transports requests).

The URI paths of uripath use it too: with this distribution installed, with_session() and PATHAPI_HTTP_TRANSPORT=requests send through it.

Installation

pip install pathapi-requests

Requires pathapi and requests, which pip installs with it.

Extra Adds Needed for
socks requests[socks] (PySocks) socks4:, socks5: and socks5h: proxies

Quick start

Send through your own session. Hand the transport to an HTTPClient:

import requests
from pathapi.http import HTTPClient
from pathapi_requests import RequestsTransport

with requests.Session() as session:
    session.headers["X-Team"] = "storage"
    client = HTTPClient(RequestsTransport(session), timeout=(3, 30))
    reply = client.request("GET", "http://files.example.org/reports/today.txt")
    print(reply.read().decode())

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

Choose it for the whole process. PATHAPI_HTTP_TRANSPORT=requests makes every HTTPClient that was given no transport send through a new session:

PATHAPI_HTTP_TRANSPORT=requests python -c "from pathapi.http import HTTPClient; print(type(HTTPClient().transport))"

Pick a proxy per URL. proxies is indexed with the request URL and answers a proxy, or None for no proxy; KeyError leaves it to requests:

from pathapi_requests import RequestsTransport


class ByHost:
    def __getitem__(self, url):
        if "internal.example.org" in url:
            return None  # direct
        if url.startswith("https://"):
            return "socks5h://gateway.example.org:1080"
        raise KeyError(url)  # what requests would have done


transport = RequestsTransport(proxies=ByHost())

API overview

Name Purpose
pathapi_requests.RequestsTransport The transport: send() and close() over a requests.Session
pathapi_requests.__version__ The installed version

pathapi.http finds the class through the requests entry of its pathapi.http_transports entry-point group, 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 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 requests, the tests pathapi runs over its own transport.

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-requests 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-requests 0.1.0
File Size Uploaded
pathapi_requests-0.1.0.tar.gz 29.3 kB Details

Built distribution (wheel)

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

Total release size: 45.9 kB

Release files / pathapi_requests-0.1.0.tar.gz

Download URL pathapi_requests-0.1.0.tar.gz
Size 29.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d77badebadc4a70171f7016af9d3e0cefed32ca02e065011aa8718a9c4ac200f
BLAKE2b-256 checksum
How to use checksums
7caf0955cf3e6ae67dbc952449691f18c612146d88e363e2dd19b4568aa3d4a7
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 15, 2026.

Transparency log

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

Download URL pathapi_requests-0.1.0-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5cbfea473054e71c290ca4c1827b6f3b23b736a1846dd3029fff0a5cc5abe69c
BLAKE2b-256 checksum
How to use checksums
6874f43efee3c259977614206407a528a3f36660ef5fa2b4e76548e78d51ddf6
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 15, 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