Skip to main content

chrome_client

PyPI 版本 Python 版本 许可证:MIT

基于 Chromium 网络栈的 HTTP/WebSocket 客户端。Core 负责 TLS、HTTP、HTTP/2、 HTTP/3/QUIC、代理和 WebSocket/WSS;Python/Rust 绑定只负责参数、类型、错误和 生命周期转换,不另实现一套网络协议。

Python API 同时对齐两套习惯:requests 的 Session/Response/异常层次,以及 curl_cffi 的 impersonate、http_version、AsyncSession、CurlMime 和 WebSocket。无法用 Chromium 忠实实现的选项会显式报错,而不是静默忽略——详见 兼容边界。

English README · 构建说明 · 兼容边界 · 第三方许可

支持范围

操作系统、架构与绑定

操作系统 Core 目标 Python 3.9–3.15 Python 3.6–3.8 Rust 备注
Linux x86 (i686)、x86_64、ARM64 ✓ ✓(独立 abi3 扩展) ✓ manylinux/glibc 运行时依赖见 manifest
Linux ARMv7 (hard-float, NEON) 未发布 未发布 ✓ Core 已构建并审计;不发布 wheel,需自行构建扩展
Windows x86、x86_64、ARM64 ✓ x86/x86_64 ✓ ✓ DLL 随 wheel;ICU 数据已编入库中
macOS x86_64、ARM64 ✓ ✓(独立 abi3 扩展) ✓ dylib 按架构匹配

每个 Core 产物位于 core/binaries/<target>/,带 ABI 版本、Chromium revision、 SHA-256 和依赖清单。ABI 当前为 v8。Go 和 Node.js 目录目前是绑定设计说明, 不是已发布的可安装包。

Core 体积在 6.1–9.4 MB 之间(Linux ARMv7 最小,Windows x86_64 最大,静态 MSVC/UCRT 多出约 2 MB)。IDNA-only 的 ICU 数据已编入库中,所以不需要外挂 icudtl.dat;用不到的 磁盘缓存后端不进链接产物。各平台的体积上限由 tools/audit-core-*.sh 把关,超了直接 构建失败。

Core 目录 Rust target Core 文件
linux-x86 i686-unknown-linux-gnu libminicronet.so
linux-x86_64 x86_64-unknown-linux-gnu libminicronet.so
linux-armv7 armv7-unknown-linux-gnueabihf libminicronet.so
linux-arm64 aarch64-unknown-linux-gnu libminicronet.so
windows-x86 i686-pc-windows-msvc minicronet.dll + minicronet.lib
windows-x86_64 x86_64-pc-windows-msvc minicronet.dll + minicronet.lib
windows-arm64 aarch64-pc-windows-msvc minicronet.dll + minicronet.lib
macos-x86_64 x86_64-apple-darwin libminicronet.dylib
macos-arm64 aarch64-apple-darwin libminicronet.dylib

Chrome profile

impersonate 必须给出精确的 chrome_<major> 名称(同时接受 curl-cffi 风格的 chrome<major> 别名)。不接受裸的 chrome/chromium:那会解析到本构建恰好 最后收录的 profile,一旦新增 profile,调用方的指纹就会在无人要求的情况下改变, 因此抛 ImpersonateError 并要求写明确切版本。当前支持 Chrome 86–157,共 72 个 profile;范围外的版本抛 ImpersonateError,不会静默降级。 available_profiles() 返回完整列表。Edge、Safari、Firefox、Tor 等非 Chromium 目标 同样显式报错,而不是当作 Chrome 处理。

Chrome 主版本 可用 profile
86–92 chrome_86 … chrome_92(各自 tag 独立审计;无 ALPS 扩展,H3 基准缺失,见 docs/CHROME_86_98_SUPPORT.md)
93–98 chrome_93 … chrome_98
99–105 chrome_99 … chrome_105
106–112 chrome_106 … chrome_112
113–119 chrome_113 … chrome_119
120–126 chrome_120 … chrome_126
127–133 chrome_127 … chrome_133
134–140 chrome_134 … chrome_140
141–147 chrome_141 … chrome_147
148–157 chrome_148 … chrome_157(chrome_154–chrome_157 用基于 156 内核的 Core,指纹分别按各自 tag 审计)

Profile 影响 TLS ClientHello、ALPN、HTTP/2 设置、QUIC/H3 和相关 Chromium 网络 参数;它不是完整 Chrome 浏览器,也不包含 Blink、扩展、Service Worker 或持久化 浏览器 Profile。

功能矩阵

功能 Python Rust/Core 说明
HTTP/1.1、HTTP/2、HTTP/3/QUIC ✓ ✓ 默认由 Chromium 协商;http_version="v1"/"v2"/"v3" 可强制
HTTPS/TLS、证书校验 ✓ ✓ verify=False 或 verify="/path/ca.pem" 自定义 CA;证书失败按具体检查项报错
HTTP/HTTPS/SOCKS 代理 ✓ ✓ proxy、Requests 风格 proxies,运行期可改
同步请求 ✓ ✓ 同步等待释放 GIL,可直接放进线程池
asyncio 请求 ✓ — Core 回调唤醒事件循环,无请求线程池;每次唤醒批量取事件
流式响应 iter_content / aiter_content / raw ResponseStream 每请求 body 队列上限 1 MiB,超限由 ABI v8 暂停读取
分块上传 data= 传文件对象或迭代器 Upload::Chunked 同步与异步都走 upload_write
取消、超时、大小限制 ✓ ✓ Timeout、ResponseTooLarge、RequestException
WebSocket / WSS ✓ ✓ 同步与异步,curl-cffi 方法名齐全
Cookie ✓ ✓ session.cookies 为 RequestsCookieJar,读写都生效
重定向 ✓ ✓ history、最终 URL、max_redirects、allow_redirects=False
内存缓存 ✓ ✓ 随 Engine 生命周期存在,cache=False 可关闭

安装与加载 Core

python -m pip install chrome-client

已发布的 wheel 自带对应平台的 native 扩展。从源码使用时,先针对某个 Core 目录构建 扩展(MINICRONET_CORE_DIR 在构建期读取),运行时把同一目录放到加载路径上:

MINICRONET_CORE_DIR=$PWD/core/binaries/linux-x86_64 cargo build --release -p chrome-client-python

LD_LIBRARY_PATH=$PWD/core/binaries/linux-x86_64 PYTHONPATH=bindings/python python -c \
  'import chrome_client; print(chrome_client.get("https://example.com").status_code)'

类型提示

包里带 py.typed 和完整的 .pyi 存根(bindings/python/chrome_client/**/*.pyi), 所以不需要额外的 stub 包:IDE 直接补全每个参数、识别返回值,并在悬停里显示 Args/Returns/示例。运行时行为不变——存根不参与导入,typing_extensions 只是类型检查期依赖。

from chrome_client import Session

with Session(impersonate="chrome_155") as session:
    session.get(url, timeout=(5, 15))
    # 悬停 impersonate= 会列出 chrome_86 … chrome_157,以及 curl-cffi 的
    # chrome<major> 别名;裸 chrome/chromium 会被拒绝
    # session.get(...) 会补全 headers/cookies/data/json/timeout/proxies/verify/...

impersonate 与 http_version 用 Literal 给出了全部可选值;请求方法的全部选项 (headers、cookies、data、json、timeout、proxies、verify、auth 等) 都写成具名参数而不是藏在 **kwargs 里,PyCharm 等任何 IDE 都能补全, impersonate="chrome_200" 或拼错的选项在写代码时就会被标出,而不是等到运行期。覆盖范围、存根与实现的校验方式见 类型提示说明。

Python 使用示例

requests 风格

import chrome_client as requests          # 或 from chrome_client import requests

response = requests.get(
    "https://example.com/api",
    params={"page": 1},
    headers={"Accept": "application/json"},
    impersonate="chrome_155",
    timeout=15,
)
response.raise_for_status()
print(response.status_code, response.reason, response.json())

Session 与 requests.Session 同形:headers、params、cookies、proxies、 auth、hooks、stream、verify、max_redirects、trust_env、adapters、 mount()、prepare_request()、send()、resolve_redirects()、close() 和 上下文管理器都可用。

from chrome_client import Session

with Session() as session:
    session.headers.update({"Accept": "application/json"})
    session.get("https://example.com/login")          # 服务端 Set-Cookie
    print(session.cookies.get_dict())                  # 会话内可见
    session.cookies.set("consent", "1", domain="example.com", path="/")
    session.get("https://example.com/private")         # 自动带上两类 cookie

会话保持:cookie 与代理

session.cookies 是 RequestsCookieJar(http.cookiejar.CookieJar 子类), 带 domain/path/secure 元数据,读写都会生效:

session.cookies.get_dict()
session.cookies.get_dict(domain="example.com")
session.cookies.set("sid", "abc", domain="example.com", path="/")
session.cookies.update({"a": "1"})
del session.cookies["sid"]
session.cookies.clear()

响应侧 cookie 由 Core 内的 Chromium CookieMonster 拥有并自动附加;facade 会把每 一跳(含重定向)的 Set-Cookie 同步进 session.cookies 和 response.cookies。 当调用方改动 jar 与 Core 已存的 cookie 冲突时,Core 会覆盖请求头,因此 facade 会 换一个空 cookie store 的同配置 Engine,让改动真正生效——连接池仍按配置复用。

session.proxies 是普通可变映射,运行期改动立即生效:

session.proxies.update({"https": "http://user:pass@127.0.0.1:8080"})
session.get("https://example.com")                     # 走代理
session.proxies.clear()
session.get("https://example.com")                     # 直连
session.get("https://example.com", proxy="socks5://127.0.0.1:1080")   # 单次覆盖

proxies 按 scheme://host、scheme、all://host、all 顺序匹配;显式 proxy= 优先。trust_env=True(默认)时读取 HTTP_PROXY/HTTPS_PROXY/ NO_PROXY。代理是 Engine 级设置,切换代理会换一个 Engine,但 jar 里的 cookie 会 继续随请求发出。

代理池要把 max_engines 设到不小于池大小。 一个 Engine 是一整个 Chromium URLRequestContext(独立线程、socket 池、DNS 缓存、TLS 会话缓存),一个会话默认 只保留 8 个(max_engines=8),超出按 LRU 淘汰。池比它大时,每个请求都会重建上下文 并新开一条 TCP 连接,而不是复用——20 个代理跑 200 个请求的实测:

max_engines 构建的 Chromium 上下文 代理侧 TCP 连接 遗留 TIME_WAIT
8(默认) 200 200 +180
20 20 20 +20
session = chrome_client.Session(max_engines=32)   # 池有 32 个端点

不必靠 TIME_WAIT 才发现这件事:Session.stats 直接给出计数。

with chrome_client.Session(impersonate="chrome_151") as session:
    session.get(url)
    session.get(url)
    print(session.stats)
    # {'live': 1, 'hits': 1, 'builds': 1, 'evictions': 0, 'deferred': 0,
    #  'inflight': 0, 'generation': 0, 'max_engines': 8}

builds 一直涨就是每次请求都在换传输上下文;hits 才代表连接、TLS 会话 (session resumption)和 HTTP/2/3 会话池被真正复用。

Session.binding(url) 返回这条请求将要使用的传输上下文本身——profile(JA3/JA4、 H2 SETTINGS 与伪头部、QUIC 传输参数都由它冻结)、代理、TLS 校验策略。两个 binding 相等的请求共享同一个 URLRequestContext:

with chrome_client.Session(impersonate="chrome_151", proxy="http://p:8080") as session:
    print(session.binding("https://example.com"))
    # SessionBinding(impersonate='chrome_151', proxy='http://p:8080')

代理规则优先走 Chromium 原生语法,只在原生不支持时才扩展。原生可解析的三种 形式会原样交给 Core(此前 facade 会把它们重写成单个 scheme://host,直接弄坏):

原生形式 含义 之前
http=h:p 只给 HTTP 用这个代理 被改写成 http://http=h:p
http=h:p;https=h:p 按目标 scheme 分别指定 被改写
http://a:p,http://b:p 回退列表,按顺序试 被拒绝
direct:// 不走代理 被当成未知 scheme 拒绝

这些只做校验(规则键、direct:// 位置、内嵌凭据)后原字节透传。其余都是 扩展层,只在 Chromium 直接拒绝该输入时才存在:

写法 处理 原因
http:// https:// socks:// socks4:// socks5:// 原样使用 Chromium 原生白名单
socks5h:// 改写为 socks5:// 同名同事,Chromium 只是少了这个拼写
socks4a:// UnsupportedFeature 要求远端解析,Core 没有
quic:// UnsupportedFeature 本构建未开 ENABLE_QUIC_PROXY_SUPPORT
host:port(无 scheme) http://host:port Chromium 把裸规则默认成 HTTP
尾部 /、路径、#片段、换行、空白 剥掉 规则只有 host:port
host:(空端口) InvalidProxyURL Chromium 同样拒绝
host:0 保留端口 0 ParsePort("0") 是真端口,不是默认值
权限部分后面的多余文本 / 未知 scheme / ?query / 双 scheme InvalidProxyURL 无法解析

原生规则键是 http/https/ftp/socks;socks= 按 Chromium 语义默认 SOCKS4, 要 SOCKS5 请写 socks=socks5://h:p。SOCKS5 的账号密码认证不支持 (Chromium 只提供 0x00 无认证方式),需要认证请用 HTTP/HTTPS 代理。细节见 docs/COMPATIBILITY_BOUNDARY.md。

重定向、异常与响应

response = session.get("https://example.com/r")
print(response.url, response.history, response.redirect_count)
response = session.get("https://example.com/r", allow_redirects=False)
print(response.status_code, response.headers["Location"], response.next.url)
session.get("https://example.com/r", max_redirects=5)   # 超限抛 TooManyRedirects

max_redirects 必须小于 20(Chromium 在一个 URLRequest 内停在上限 20); 大于等于 20 抛 UnsupportedFeature,不静默钳到 20。默认值是 None,含义是 「采用 Chromium 的 20」,不是 requests 的 30——requests.models.DEFAULT_REDIRECT_LIMIT 仍是 30 且仍可导入,但本包不把它当作默认值。

异常层次与 requests.exceptions 一致(RequestException 继承 IOError), 并补上 curl-cffi 的叶子类型。Chromium 的 net error 会映射成具体类型和可读名字:

try:
    session.get("https://expired.example.com")
except chrome_client.CertificateVerifyError as error:
    print(error)          # ERR_CERT_DATE_INVALID (net error -201)
except chrome_client.ConnectionError:
    ...
except chrome_client.Timeout:
    ...

证书失败按具体检查项区分:过期 ERR_CERT_DATE_INVALID (-201)、主机名不匹配 ERR_CERT_COMMON_NAME_INVALID (-200)、CA 不受信 ERR_CERT_AUTHORITY_INVALID (-202), 类型均为 CertificateVerifyError(继承 SSLError → ConnectionError)。要接受私有 CA 用 verify="/path/ca.pem",完全跳过校验用 verify=False(Engine 级设置)。

Response 提供 status_code、reason、headers、cookies、history、 elapsed、request、url、encoding、apparent_encoding、text、content、 json()、raw、links、is_redirect、is_permanent_redirect、next、ok、 raise_for_status()、iter_content()、iter_lines()、close(),以及 curl-cffi 的 http_version、charset、redirect_count、redirect_url。

curl-cffi 风格:指纹与协议

from chrome_client import Session, AsyncSession, CurlMime

with Session(impersonate="chrome152", http_version="v2") as session:
    session.get("https://example.com")

impersonate 接受 chrome_155、chrome155,以及解析到最新 pinned 版本的 chrome。TLS ClientHello、ALPN、HTTP/2 设置与优先级、HTTP/3 传输参数全部来自该 profile:这也是 ja3=、akamai=、perk= 和大部分 extra_fp 字段会抛 UnsupportedFeature 的原因——接受一个 JA3 字符串却仍然发送 Chromium 自己的 ClientHello,等于谎报保真度。extra_fp 中 facade 能真正实现的两项会被采纳: header_order 和 form_boundary。

http_version=v1 的 ALPN 与 ALPS 是有意的差异,不是指纹缺陷。 强制 HTTP/1.1 时 ALPN 只发 http/1.1;ALPS(扩展 17613)也随之为空——Chromium 只对 alpn_protos 里存在的协议声明 ALPS,而 application_settings 表只装了 h2 的条目 (net/socket/ssl_client_socket_impl.cc 的 alpn_protos 循环)。真实 Chrome 走同一路径, 基准里的 h1 抓包同样没有该扩展。因此用 peetprint 对照时,v1 要对 h1 抓包, normal/H2 才对 h2 抓包;拿 v1 去对 h2 抓包必然只报这两处。trust_anchors(0xca34) 与协议无关,h1 下照常发送,不要把它一并当成"h1 本该没有"。 门禁见 tools/audit-h1-alps-absence.py。

默认请求头来自 profile 自己的抓包。 impersonate="chrome_155" 发出的头集合, 与那个版本的 Chrome 在 profiles/chrome_155/h1/captures.json 里留下的六条抓包逐字节 一致——顺序也一致,包含 sec-ch-ua、sec-ch-ua-mobile、sec-ch-ua-platform、 Upgrade-Insecure-Requests、Accept、四个 Sec-Fetch-*、Accept-Encoding、 Accept-Language。72 个 profile 全部如此,bindings/python/tests/test_client_hints.py 逐个比对,tools/audit-client-hints.py 在提交前重新从抓包推导整张表。

这些头由 facade 注入,不是 Core 发的:Chrome 自己是在 services/network 的 URLLoader 工厂层生成它们的,而 net::URLRequestContextBuilder 只暴露 set_user_agent / set_accept_language。要 Core 自己产出它们仍需 ABI v9 (见 docs/NEXT_STEPS.md); facade 注入的代价是这些头不在 Chromium 的 net 层,而在请求的 extra headers 里。

平台跟随宿主,不跟随抓包。 抓包来自 Windows 桌面,但客户端不能声称一个 套接字并不在的平台。User-Agent 的括号组与 sec-ch-ua-platform 都按宿主重写, 与 Core 自己的推导(core/source/minicronet.cc 的 BUILDFLAG(IS_WIN/IS_MAC) 分支) 保持一致——"Windows" 的 hint 配 X11; Linux 的 UA 比缺一个 hint 更容易被检出。

Sec-Fetch-* 描述的是顶层导航。 每条抓包都是一次导航,因为浏览器打开 URL 就是 导航,而 session.get(url) 是同一件事。要子资源语义就自己传那两个字段,其余字段 仍然保留:

session.get(url, headers={"Sec-Fetch-Site": "same-origin",
                          "Sec-Fetch-Mode": "no-cors",
                          "Sec-Fetch-Dest": "image"})
session.get(url, headers={"Sec-Fetch-User": None})   # 删掉单个注入的字段
session.get(url, default_headers=False)              # 整个注入关掉

impersonate=None 时一个都不注入:没有声称自己是浏览器的会话不该看起来像 Chrome。

Priority 是这条规则的例外:RFC 9218 的 priority 请求头由 net 层自己序列化 (net/spdy/spdy_http_utils.cc 的 CreateSpdyHeadersFromHttpRequest),不经 URLLoader。因此 chrome_124 起的 profile 会自动带上它,取值由请求优先级决定—— 这些 profile 的默认优先级是 highest,发出的正是真实 Chrome 导航的 priority: u=0, i;chrome_86–123 不发这个头,与它们的抓包一致。HTTP/1.1 上不发。

不受支持而显式报错的还有:cert=(客户端证书)、interface=、doh_url=、 curl_options=、max_recv_speed=、referer=。referer 尤其容易误判:Chromium 自己拥有 referrer 并会剥掉调用方设置的 Referer 头,ABI v8 也没有 referrer 字段, 所以设置它在任何路径下都不会到达网络。

multipart 两种写法都支持:

session.post(url, data={"title": "t"}, files={"f": ("a.txt", b"...", "text/plain")})

mime = CurlMime()
mime.addpart(name="title", data="hello")
mime.addpart(name="photo", filename="p.jpg", content_type="image/jpeg",
             local_path="/tmp/p.jpg")
session.post(url, multipart=mime)

流式读写与分块上传

with session.stream("GET", "https://example.com/large") as response:
    for chunk in response.iter_content(64 * 1024):
        ...

response = session.get(url, stream=True, max_response_bytes=16 * 1024 * 1024)
try:
    for line in response.iter_lines():
        ...
finally:
    response.close()        # 未读完时取消 native 请求

with open("big.bin", "rb") as handle:
    session.post(url, data=handle)      # 文件对象或迭代器走分块上传

max_response_bytes 超限会取消请求并抛 ResponseTooLarge。每个请求的 body 队列 上限 1 MiB,超过时 ABI v8 用 MN_READ_PAUSE 暂停读取,不会占住 Core 线程。

并发

同步 Session 可直接跨线程共享:所有阻塞调用都释放 GIL,Engine 缓存有锁。

from concurrent.futures import ThreadPoolExecutor

with Session() as session, ThreadPoolExecutor(max_workers=32) as pool:
    codes = list(pool.map(lambda url: session.get(url).status_code, urls))

asyncio 路径不创建线程池:Core 回调用 call_soon_threadsafe 唤醒事件循环,每次 唤醒批量取事件,因此一个几 MB 的响应不会按 chunk 逐次往返事件循环。

import asyncio
from chrome_client import AsyncSession

async def main():
    async with AsyncSession(impersonate="chrome_155", max_clients=64) as session:
        responses = await asyncio.gather(*[session.get(u) for u in urls])
        async with session.stream("GET", big_url) as response:
            async for chunk in response.aiter_content(65536):
                ...

asyncio.run(main())

max_clients 限制同时在途的请求数。进程池请使用 spawn 或 forkserver:Engine 存在后进程已是多线程且 Chromium 线程持锁,fork() 可能在子进程执行任何 Python 代码之前就死锁。

Chromium 对同一 host 组默认最多 6 条 HTTP/1.1 连接(实测同一 host 并发上限确为 6, 换用多个 host 后吞吐随之上升)。这是浏览器语义的一部分,不是绑定的瓶颈:需要更高 单 host 并发时应使用 HTTP/2 或 HTTP/3 端点。

WebSocket / WSS

from chrome_client import WebSocket

with WebSocket(url="wss://echo.example.com", impersonate="chrome_155") as socket:
    socket.send_str("ping")
    print(socket.recv_str())
async def main():
    async with AsyncSession() as session:
        socket = await session.websocket("wss://echo.example.com")
        async with socket:
            await socket.send_json({"op": "ping"})
            print(await socket.recv_json())

同步与异步都提供 send/send_str/send_bytes/send_json/ping、 recv/recv_str/recv_bytes/recv_json/recv_fragment、close、terminate, 同步侧还有 run_forever(on_message=..., on_error=..., on_open=..., on_close=...)。 构造函数返回时握手已完成——Core 在 open 之前会拒绝 send() 和 close()。

握手头有两条 Chromium 规则:

  • UA 不能按次传。 Core 明确拒绝把 User-Agent、Host、Origin、 Connection、Upgrade、Sec-WebSocket-* 作为额外头(IsForbiddenWebSocketHeader), 因为 Chromium 自己决定这些头的取值和在握手里的位置,而 UA 的位置本身就是指纹的 一部分。要改 WebSocket 的 UA,用 Session(user_agent=...)(Engine 级设置,HTTP 与 WS 一致)或换 impersonate profile;传 header 会得到 UnsupportedFeature,而不是 静默生成一个与其它请求 UA 不一致的握手。
  • Origin 默认取自 URL 自身。 Core 拒绝空 origin,而这里没有页面可继承,所以 默认用 ws://host:port 对应的 http://host:port——即同源页面发起连接的样子。需要 别的值就显式传 origin=。

Cookie 会按 URL 匹配后附加到握手上。

与 requests / curl-cffi 的对照

from curl_cffi import requests 改成 from chrome_client import requests,或 import requests 改成 import chrome_client as requests,多数代码不需要其他改动。

用法 支持情况
get/post/put/patch/delete/head/options/trace/query ✓
Session、AsyncSession、Client、AsyncClient ✓(Client 是 Session 别名)
params、data、json、content、files、multipart ✓
headers、cookies、auth、timeout(含 (connect, read)) ✓
proxies、proxy、proxy_auth、trust_env、NO_PROXY ✓
verify=True/False/"/path/ca.pem" ✓
allow_redirects、max_redirects、history、最终 URL ✓
stream=True、iter_content、iter_lines、raw ✓
aiter_content、aiter_lines、atext、acontent、session.stream(...) ✓
hooks={"response": ...}、prepare_request、send、mount、自定义 adapter ✓
Request、PreparedRequest、codes、CaseInsensitiveDict、Headers、Cookies ✓
HTTPBasicAuth、HTTPProxyAuth、AuthBase ✓
requests.exceptions 全层次 + curl-cffi 叶子类型 ✓
impersonate、http_version、retry/RetryStrategy、raise_for_status=True ✓
base_url、discard_cookies、default_encoding、content_callback ✓
CurlMime、ExtraFingerprints(header_order=..., form_boundary=...) ✓
HTTPDigestAuth 部分:需要用 parse_challenge()/handle_401() 显式驱动
HTTPAdapter(pool_connections=..., pool_maxsize=...) 接受但不生效:连接池由 Chromium 拥有
ja3、akamai、perk、extra_fp 的 TLS/HTTP2 字段 ✗ 显式抛 UnsupportedFeature
cert(客户端证书)、interface、doh_url、curl_options、max_recv_speed ✗ 显式抛 UnsupportedFeature
referer= / Referer 头 ✗ 显式抛 UnsupportedFeature(Chromium 会剥掉)
持久化 cookie/cache 文件、Curl 低层句柄、CurlOpt/CurlInfo ✗

行为差异(有意为之,不是缺陷):

  • 模块级 chrome_client.get(...) 共用一个进程内 Session,因此也共用连接池和 cookie store。requests 每次新建 Session;这里一个 Session 等于一整个 Chromium URLRequestContext,按次新建会付出线程与内存代价。需要隔离时显式建 Session, 或调用 close_shared_session()。
  • session.headers 默认为空。requests 会预置 User-Agent/Accept/ Accept-Encoding/Connection,而这里 Chromium 只自己发 Host/Connection/ User-Agent/Accept-Encoding;Accept 两者都不发,注入 Accept: */* 反而会被 指纹检测看见(真实 Chrome 是发的,见上文的 client hints 说明)。
  • Response.raw 是覆盖 read/stream/close 的文件对象,不是 urllib3 HTTPResponse。
  • Response.ok 用 requests 语义(status_code < 400),不是 curl-cffi 的 200–399。

目录与验证

路径 内容
core/abi/ 稳定 C ABI v8
core/binaries/ 9 个已审计平台 Core
crates/minicronet/ Rust 安全层、流和生命周期
bindings/python/ Python 3.9–3.15 绑定与共享 facade
bindings/python36/ Python 3.6–3.8 独立 abi3 绑定(共用同一 facade)
bindings/python/tests/ test_stability.py 生命周期与并发;test_compat.py requests/curl-cffi 兼容面
docs/ 构建、平台、ABI、兼容性和审计说明

回归测试需要已审计的 Core:

LD_LIBRARY_PATH=core/binaries/linux-x86_64 PYTHONPATH=bindings/python \
  python -m unittest discover -s bindings/python/tests -p "test_*.py"

Metadata

Release files for chrome-client 0.2.9

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

Built distributions (wheels)

Table of built distributions (wheels) for chrome-client 0.2.9
File Actions
chrome_client-0.2.9-cp39-abi3-win_arm64.whl CPython 3.9 abi3 Windows ARM64 Details for chrome_client-0.2.9-cp39-abi3-win_arm64.whl
chrome_client-0.2.9-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for chrome_client-0.2.9-cp39-abi3-win_amd64.whl
chrome_client-0.2.9-cp39-abi3-win32.whl CPython 3.9 abi3 Windows x86-32 Details for chrome_client-0.2.9-cp39-abi3-win32.whl
chrome_client-0.2.9-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for chrome_client-0.2.9-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
chrome_client-0.2.9-cp39-abi3-manylinux2014_i686.manylinux_2_17_i686.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-32 Details for chrome_client-0.2.9-cp39-abi3-manylinux2014_i686.manylinux_2_17_i686.whl
chrome_client-0.2.9-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for chrome_client-0.2.9-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
chrome_client-0.2.9-cp39-abi3-macosx_13_0_x86_64.whl CPython 3.9 abi3 macOS 13.0+ x86-64 Details for chrome_client-0.2.9-cp39-abi3-macosx_13_0_x86_64.whl
chrome_client-0.2.9-cp39-abi3-macosx_13_0_arm64.whl CPython 3.9 abi3 macOS 13.0+ ARM64 Details for chrome_client-0.2.9-cp39-abi3-macosx_13_0_arm64.whl
chrome_client-0.2.9-cp36-abi3-win_amd64.whl CPython 3.6 abi3 Windows x86-64 Details for chrome_client-0.2.9-cp36-abi3-win_amd64.whl
chrome_client-0.2.9-cp36-abi3-win32.whl CPython 3.6 abi3 Windows x86-32 Details for chrome_client-0.2.9-cp36-abi3-win32.whl
chrome_client-0.2.9-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.6 abi3 Linux glibc 2.17+ x86-64 Details for chrome_client-0.2.9-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
chrome_client-0.2.9-cp36-abi3-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.6 abi3 Linux glibc 2.17+ x86-32 Details for chrome_client-0.2.9-cp36-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
chrome_client-0.2.9-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.6 abi3 Linux glibc 2.17+ ARM64 Details for chrome_client-0.2.9-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
chrome_client-0.2.9-cp36-abi3-macosx_13_0_x86_64.whl CPython 3.6 abi3 macOS 13.0+ x86-64 Details for chrome_client-0.2.9-cp36-abi3-macosx_13_0_x86_64.whl
chrome_client-0.2.9-cp36-abi3-macosx_13_0_arm64.whl CPython 3.6 abi3 macOS 13.0+ ARM64 Details for chrome_client-0.2.9-cp36-abi3-macosx_13_0_arm64.whl

Total release size: 76.7 MB

Release files / chrome_client-0.2.9-cp39-abi3-win_arm64.whl

Download URL chrome_client-0.2.9-cp39-abi3-win_arm64.whl
Size 4.8 MB
Tags CPython 3.9 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
a2b4ac20c239a2237134af5d34b5ca27a9e64554bf52d5cdec4b902c2cc9875c
BLAKE2b-256 checksum
How to use checksums
d6183dda677fb6c93ba8e6df2a76b4ee4bebd89bdecdaad106f04f87e25a38b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp39-abi3-win_amd64.whl

Download URL chrome_client-0.2.9-cp39-abi3-win_amd64.whl
Size 5.4 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
586a283265f4dad5b87a3e7c1f0a00f6f35ffd17e603e3b4197ecdc09b472a68
BLAKE2b-256 checksum
How to use checksums
292ff7b3465144f3e9b9e60215b7a285b3d2ae17860e8a665bd4ea12d1b2f034
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp39-abi3-win32.whl

Download URL chrome_client-0.2.9-cp39-abi3-win32.whl
Size 4.8 MB
Tags CPython 3.9 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
37446bc2f0eec2a85dd9d1acfe083667121149dad2e32a426b5483d23963af00
BLAKE2b-256 checksum
How to use checksums
6f2cb8746c04a0e8c4fa2cfa202676282d8c3b239b4cde20a3b7b7e03fbd7b69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL chrome_client-0.2.9-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 5.7 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
45b3949d1aa0b8dd7db93ee9c639a215f400d63a0efa3a8d0f659764d35b91f8
BLAKE2b-256 checksum
How to use checksums
8ae88c7f04aa06d55d8eeeea896c999ab799bf12e61f645b55ce9a85a6d95daa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp39-abi3-manylinux2014_i686.manylinux_2_17_i686.whl

Download URL chrome_client-0.2.9-cp39-abi3-manylinux2014_i686.manylinux_2_17_i686.whl
Size 5.8 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-32 abi3
SHA-256 checksum
How to use checksums
262b53bca6a008272362be41fa2b11621b60c520890a775f795795f606c1b8ab
BLAKE2b-256 checksum
How to use checksums
3f4b7628e3eeb19eb1fb49d1bb58076405a3038c00dddd95701f581a4f311986
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL chrome_client-0.2.9-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 5.5 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
9382b4fd865a6145040ace3cdd0204114e20af5441d7899569e9d9204b9f8f62
BLAKE2b-256 checksum
How to use checksums
c0182a5d6331a22ee91e2c7820a9a8beb9b1278bdf73b1cfbbc8b020697cd05f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp39-abi3-macosx_13_0_x86_64.whl

Download URL chrome_client-0.2.9-cp39-abi3-macosx_13_0_x86_64.whl
Size 4.8 MB
Tags CPython 3.9 abi3 macOS 13.0+ x86-64
SHA-256 checksum
How to use checksums
667522ed34bb523de65c9163081a95fb3f01b58d5050680465acf419ab4b5b03
BLAKE2b-256 checksum
How to use checksums
c350419c07baf25b8e0b905185c4ef7ce9ddc9241475cdcc27787b0ab53cb2b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp39-abi3-macosx_13_0_arm64.whl

Download URL chrome_client-0.2.9-cp39-abi3-macosx_13_0_arm64.whl
Size 4.4 MB
Tags CPython 3.9 abi3 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
bc9ac2b5b7c89bd0a5116db71964b1d216f4bb9908af0500e107297c95cd10f0
BLAKE2b-256 checksum
How to use checksums
dab3576f8aab40f8d6efb17f8f7383bacee3e20d4e34efb182b372e23c5e1813
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp36-abi3-win_amd64.whl

Download URL chrome_client-0.2.9-cp36-abi3-win_amd64.whl
Size 5.3 MB
Tags CPython 3.6 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
c4ba7d73d6f91f7a2339787e2092d103efa61674e82d6582107e57f8cd97e6af
BLAKE2b-256 checksum
How to use checksums
9b19144ab7e2e7d5fd2f40506d5897e8ca5fac6b2e5965aefe92ab272e845deb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp36-abi3-win32.whl

Download URL chrome_client-0.2.9-cp36-abi3-win32.whl
Size 4.7 MB
Tags CPython 3.6 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
e08e968e50f873c2541516d04155387a9e74322796c88a73177259e682f0dd43
BLAKE2b-256 checksum
How to use checksums
ed72a50a369f654233cfc318eacf4ab619cc972751b04e96567da9eaab15b259
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chrome_client-0.2.9-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.5 MB
Tags CPython 3.6 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
edb11185bb476a113fb94e5fcbde4512e6b5e274c9ebb7eb6e1152e8c8a42a14
BLAKE2b-256 checksum
How to use checksums
7ff4f832a7b57d65d3033b6e0740c3e8d288ec0b171d6cb27b57fe0dbe2f275c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp36-abi3-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL chrome_client-0.2.9-cp36-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Size 5.7 MB
Tags CPython 3.6 Linux glibc 2.17+ x86-32 abi3
SHA-256 checksum
How to use checksums
20fe50b51b446fee1c22dd69876a118e012c8635b77274f75397e4f5c3d1dd9a
BLAKE2b-256 checksum
How to use checksums
05fa032e97e1d82adc2b24153002e041163e7a9cf549d6d2bdff14cc3a314d55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL chrome_client-0.2.9-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.3 MB
Tags CPython 3.6 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
0ed966738be2308c566069ba742a25620641d8a3fa341328f57b6fa34cf264d2
BLAKE2b-256 checksum
How to use checksums
7ac67f75dda4c646577f7394ed37a4b707a71b70d1217a278a18a9740e581be3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp36-abi3-macosx_13_0_x86_64.whl

Download URL chrome_client-0.2.9-cp36-abi3-macosx_13_0_x86_64.whl
Size 4.8 MB
Tags CPython 3.6 abi3 macOS 13.0+ x86-64
SHA-256 checksum
How to use checksums
7c4facbc931393ea08a177eac4ab2830cebf5e8ae586e1613669bb2a3513a285
BLAKE2b-256 checksum
How to use checksums
1ce7ec3574ad6f8231aa292d03c40303b07116bff3c8cdd98e63f21c3fda65e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / chrome_client-0.2.9-cp36-abi3-macosx_13_0_arm64.whl

Download URL chrome_client-0.2.9-cp36-abi3-macosx_13_0_arm64.whl
Size 4.3 MB
Tags CPython 3.6 abi3 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
c6949fd815836a2cf56a3c40f34afc6cd6d4fb1bd7375c65b4827596dd2fba50
BLAKE2b-256 checksum
How to use checksums
9975180c3be7181757f6df7c60c67bce4c2c93d8a1b32fa69e294f45aeb65e25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Security for chrome-client 0.2.9

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 15 files in this release have been uploaded with provenance metadata.

Select from 15 files

Attestation for chrome_client-0.2.9-cp39-abi3-win_arm64.whl

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 Nov 24, 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.

Release history Release notifications | RSS feed

This release

0.2.9 This release

15 release files Full provenance

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