Client-side WHATWG fetch for hayate: the same Request/Response types, pointed outward
Project description
hayate-fetch
Client-side WHATWG fetch for hayate: the same Request/Response types your server handles, pointed outward.
Status: alpha (0.1.x), typed.
fetch(), theFetchBackendprotocol, 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
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 public 0.1 contract. Redirects follow by default,
or pass default_backend(redirect="manual") to surface redirects consistently
on CPython and Workers.
Backends
- CPython:
UrllibBackenduses the standard library throughasyncio.to_thread, so the package adds no HTTP dependency. - Cloudflare Workers:
WorkersBackendpasses through to the platform's JavaScriptfetch. - Custom clients: implement the async
FetchBackend.send(Request) -> Responseprotocol and pass it asbackend=.
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hayate_fetch-0.1.2.tar.gz.
File metadata
- Download URL: hayate_fetch-0.1.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d7dc3ff0f768522f0d6f4bd23bd7c269cf0480d38bc986a1ac849a6510868c1
|
|
| MD5 |
f64e2b7aa56c3c0177588eb351523f93
|
|
| BLAKE2b-256 |
a7efa77a5ea2e9127d44ba1d6d6b45cccab620a07b6bb6ae62a2bf9a65fc3256
|
Provenance
The following attestation bundles were made for hayate_fetch-0.1.2.tar.gz:
Publisher:
release.yml on hayatepy/hayate-fetch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hayate_fetch-0.1.2.tar.gz -
Subject digest:
5d7dc3ff0f768522f0d6f4bd23bd7c269cf0480d38bc986a1ac849a6510868c1 - Sigstore transparency entry: 2235371191
- Sigstore integration time:
-
Permalink:
hayatepy/hayate-fetch@6e18c4b618ea9d16ed8d891e4eb29358a3306c03 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/hayatepy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6e18c4b618ea9d16ed8d891e4eb29358a3306c03 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hayate_fetch-0.1.2-py3-none-any.whl.
File metadata
- Download URL: hayate_fetch-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ae68e53e17b8c02e01fba181509eeb966a1c3e505ca7fb7efe4aabfabadf495
|
|
| MD5 |
dfd747371ab25dafa921cf58c2dddacf
|
|
| BLAKE2b-256 |
c8cb02ece28c807c4a099fc93fe066b2244f03099706ea1808667b1b9b543d1c
|
Provenance
The following attestation bundles were made for hayate_fetch-0.1.2-py3-none-any.whl:
Publisher:
release.yml on hayatepy/hayate-fetch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hayate_fetch-0.1.2-py3-none-any.whl -
Subject digest:
3ae68e53e17b8c02e01fba181509eeb966a1c3e505ca7fb7efe4aabfabadf495 - Sigstore transparency entry: 2235371495
- Sigstore integration time:
-
Permalink:
hayatepy/hayate-fetch@6e18c4b618ea9d16ed8d891e4eb29358a3306c03 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/hayatepy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6e18c4b618ea9d16ed8d891e4eb29358a3306c03 -
Trigger Event:
push
-
Statement type: