Skip to main content

hayate-fetch

Hayate ecosystem: Start here · Production golden app · Tested compatibility

Client-side WHATWG fetch for hayate: the same Request/Response types your server handles, pointed outward.

Status: alpha (0.x), typed. fetch(), the FetchBackend protocol, and the CPython and Cloudflare Workers backends are implemented and used by hayate-auth for OAuth token exchange. The design memo (Japanese, per project convention) lives in DESIGN.md; release history is in CHANGELOG.md.

Install

uv add hayate-fetch        # or: pip install hayate-fetch

For pooled asynchronous CPython requests, install the optional HTTPX backend:

uv add "hayate-fetch[httpx]"

Use

from hayate_fetch import fetch

response = await fetch(
    "https://api.example.com/books",
    method="POST",
    headers={"content-type": "application/json"},
    body='{"title":"Standards first"}',
)

if response.ok:
    book = await response.json()

Pass a prebuilt hayate Request when that is already the natural object:

from hayate import Request
from hayate_fetch import fetch

response = await fetch(Request("https://api.example.com/health"))

HTTP error statuses resolve to a Response; network failures raise OSError. Responses are buffered in the current public contract. Redirects follow by default, or pass default_backend(redirect="manual") to surface redirects consistently on CPython and Workers.

Backends

  • CPython: UrllibBackend uses the standard library through asyncio.to_thread, so the package adds no HTTP dependency.
  • Cloudflare Workers: WorkersBackend passes through to the platform's JavaScript fetch.
  • HTTPX (optional, CPython): HttpxBackend adapts an application-owned httpx.AsyncClient, preserving its connection pool, timeout, TLS, proxy, and optional HTTP/2 configuration.
  • Custom clients: implement the async FetchBackend.send(Request) -> Response protocol and pass it as backend=.

Keep one HTTPX client for the application lifetime rather than constructing it inside a hot request loop:

import httpx

from hayate_fetch import fetch
from hayate_fetch.httpx import HttpxBackend

async with httpx.AsyncClient() as client:
    response = await fetch(
        "https://api.example.com/books",
        backend=HttpxBackend(client),
    )

The default backend is selected from the runtime. Browser-only Fetch fields such as mode, credentials, and cache are intentionally outside the server-side subset.

License

MIT

Metadata

Release files for hayate-fetch 0.2.1

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

Source distribution (sdist)

Source distribution for hayate-fetch 0.2.1
File Size Uploaded Provenance
hayate_fetch-0.2.1.tar.gz 5.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hayate-fetch 0.2.1
File Interpreter ABI Platform
hayate_fetch-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / hayate_fetch-0.2.1.tar.gz

Download URL hayate_fetch-0.2.1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9ffea8388b928961f22a37981ca97ba812f1906180c0d2a94773072b756b3915
BLAKE2b-256 checksum
How to use checksums
d6f91a81a000b80041bdb6419193990817aa0cd337ce334fc7ba6307303a8b3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Aug 3, 2026.

Transparency log

Release files / hayate_fetch-0.2.1-py3-none-any.whl

Download URL hayate_fetch-0.2.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fbe081bed1d1d2ee11e7de9d77b519ee03ec7dbcc0f4503cca360d081b3c0397
BLAKE2b-256 checksum
How to use checksums
e3d0a54070a16822d79ee12d27dc5052d1dae87630e15ef1ff029b0b312906dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Aug 3, 2026.

Transparency log

Security for hayate-fetch 0.2.1

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hayate_fetch-0.2.1.tar.gz

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 Aug 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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