never_safari (Python)
Send local HTTP requests with a capture-validated macOS Safari 26.5.2 static
network fingerprint — TLS ClientHello (JA3/JA4), HTTP/2 (SETTINGS/WINDOW_UPDATE/
pseudo-header order), HPACK (Huffman + dynamic table), request-header order,
download flow-control cadence, and TLS-record framing — like curl_cffi, but for
Safari. Built on a patched BoringSSL plus from-scratch HTTP/1.1 and HTTP/2
layers, with opportunistic HTTP/3 and automatic protocol fallback.
Install
pip install never_safari # prebuilt wheels: macOS / Linux / Windows
# or from source (needs cmake, go, ninja, a C/C++ compiler):
pip install maturin && maturin develop -m crates/safari-py/Cargo.toml
Use — a requests-style API
import never_safari
# Session keeps cookies + a connection pool (like a browser). `Client` is an alias.
s = never_safari.Session()
r = s.get("https://tls.peet.ws/api/all", params={"pretty": "1"})
print(r.status_code, r.ok)
print(r.json()["tls"]["ja4"]) # t13d2013h2_a09f3c656075_7f0f34a4126d
# POST: json= takes a Python object; data= takes a dict (form) / str / bytes.
r = s.post("https://api.example.com/v1/items",
json={"name": "x"},
headers={"authorization": "Bearer TOKEN"})
r.raise_for_status() # raises never_safari.HTTPError on 4xx/5xx
# Module-level, exactly like requests:
never_safari.get("https://example.com", params={"q": "1"})
never_safari.post("https://api.example.com", data={"k": "v"}, timeout=10)
# Session options
s = never_safari.Session(
verify=True, # TLS cert verification (like requests)
proxies={"https": "socks5://user:pass@host:1080"}, # or HTTP CONNECT
http3=True, # default: H3 preference, then ALPN-selected H2/H1.1
multiplex=True, # default: concurrent requests share one connection
accept_language="en-US,en;q=0.9", # match the proxy/browser locale
timeout=30.0, connect_timeout=30.0, idle_timeout=60.0, max_redirects=10,
)
print(r.http_version) # "h3", "h2", or "http/1.1"
print(s.resource_stats) # live request/dial/cache counters
# `with never_safari.Session(...) as s:` or `s.close()` releases them promptly.
# Crawler resource limits are enabled automatically; constructor overrides are
# available only when a workload needs non-default tuning.
# After an OS/network change, validate and switch a live H3 path:
new_local_address = s.migrate_http3("https://example.com")
Matches requests' surface:
- Verbs:
get/post/put/patch/delete/head/options/request— on theSessionand at module level. - Request kwargs:
params=,data=(dict → form / str / bytes),json=(any object),headers=,cookies=,referer=,mode=(auto,navigation, orfetch),destination=(auto,document,empty, or capture-validatedimage),top_level_url=,referrer_policy=,timeout=(seconds, per-request),allow_redirects=(defaultTrue). Usemode="navigation"for a top-level browser load andmode="fetch"for XHR. For a browser image request, passdestination="image"together with itstop_level_urlandreferer.paramsaccepts either a mapping or(name, value)pairs and expands sequence values.dataandjsonare mutually exclusive; unsupported body types raise instead of silently sending an empty body. - Headers: supplied values are authoritative. Known Safari fields are
checked and automatically reordered into the captured profile; only omitted
fields receive defaults. Custom fields retain caller order/anchors. An
explicit
headers={"cookie": ...}replaces the jar for that request, whilecookies=augments it. Jar cookies are joined into one field on H1 and split into one incrementally indexed field per pair on H2, matching live Safari; an explicit Cookie remains intact. Names are lowercased for H2/H3 and use Safari's captured canonical casing for HTTP/1.1. Connection-specific/Host fields are removed for protocol correctness; an explicit Content-Length must equal the actual body length. Response:.status_code(.statusalias),.ok,.reason,.headers,.content,.text,.json(),.url,.resumed,.cookies,.raise_for_status().- Cookies (dict-like, like curl_cffi / httpx):
s.cookies["k"],s.cookies.get("k", domain=…, path=…),.get_dict(domain=…, path=…),.set("k", "v", domain=…, path=…),.delete("k", domain=…, path=…),.clear(domain=…, path=…),.update(),.keys()/.values()/.items(),"k" in s.cookies,dict(s.cookies);r.cookiesfor what a response set. For durable process/Redis persistence, stores.cookies.get_records()and restore each record withs.cookies.set_record(**record). This preserves complete scope and policy attributes;get_dict()is only a flattened view. never_safari.HTTPError,Session(alias ofClient).
The network call releases the GIL, so many Python threads can crawl concurrently.
Async — AsyncSession (like curl_cffi)
import asyncio, never_safari
async def main():
async with never_safari.AsyncSession() as s: # max_workers= bounds concurrency
r = await s.get("https://example.com", params={"q": "1"})
r = await s.post(url, json={"a": 1})
results = await asyncio.gather(*[s.get(u) for u in urls]) # runs concurrently
asyncio.run(main())
Same verbs, kwargs, Response and .cookies as the sync Session; every verb is
a coroutine. It runs the (GIL-releasing) sync core in a bounded thread pool, so
requests run genuinely in parallel. AsyncClient is an alias.
See the project README for the full fingerprint details and scope.
Metadata
Release files for never-safari 0.7.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| never_safari-0.7.2-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details for never_safari-0.7.2-cp39-abi3-win_amd64.whl |
| never_safari-0.7.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details for never_safari-0.7.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| never_safari-0.7.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details for never_safari-0.7.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
| never_safari-0.7.2-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details for never_safari-0.7.2-cp39-abi3-macosx_11_0_arm64.whl |
| never_safari-0.7.2-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details for never_safari-0.7.2-cp39-abi3-macosx_10_12_x86_64.whl |
Total release size: 17.0 MB
Release files / never_safari-0.7.2-cp39-abi3-win_amd64.whl
| Download URL | never_safari-0.7.2-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
fb88619cc9ea3aaedb59b83d4fcaca0e1dfd4fb4d9e2edcf2c2869817778b7d9
|
|
BLAKE2b-256 checksum How to use checksums |
fa6d1ff6ce221528fa0b84750833550d4a6e93cc15f59ddd3e03c2685d80a49c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / never_safari-0.7.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | never_safari-0.7.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.9 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
08505e3799c1d0938d4ac98123a0a6cc67f782517873770d87d5c9433223c9d1
|
|
BLAKE2b-256 checksum How to use checksums |
a3b0986634e41110209cf7e54a45bed24e937792a010fbe1615005822fbae947
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / never_safari-0.7.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | never_safari-0.7.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.8 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5fd8ad1000df54c9184b24f207ee8a1da3f72803ed7dd0a1d548d8634a7fedf5
|
|
BLAKE2b-256 checksum How to use checksums |
bc66836f4ad0fd8d18eb653475d314ceaec5ca73a539b4ddf64e11fa8bf51f2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / never_safari-0.7.2-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | never_safari-0.7.2-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
55646131c5bb5c644b34c04fe248a22c4f7b9add6433a05bbd56ec1a13af1c32
|
|
BLAKE2b-256 checksum How to use checksums |
17cede422b3e29409e6ea73fd213bfff71cc2e60fd5580ccb38cb8cd2bbc4d8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / never_safari-0.7.2-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | never_safari-0.7.2-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
0d85f87e44551e46e88fd2db0bc74e79c3873ffc20b29cbc578dd8131e543f3c
|
|
BLAKE2b-256 checksum How to use checksums |
323c8a22bb1098749c17c5c6d9728a28c1758c4c81e57f50d834f0ee5806538e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Security for never-safari 0.7.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.