Skip to main content

tlsreq

curl_cffiwreqniquests+utlshttpx+utls 收成同一套 Session API。换库只改 backendimpersonate

GitHub: https://github.com/xiaoweigege/tlsreq

安装

pip install tlsreq
pip install "tlsreq[httpx]"      # 或 niquests / wreq / curl_cffi / all

Chrome 152 不在 PyPI 的 utls 里。httpx / niquests 需要再装 GitHub 2026.9.4:

https://github.com/xiaoweigege/utls/releases/tag/2026.9.4

python -m tlsreq.install_utls
# 或 tlsreq-install-utls

用法

from tlsreq import AsyncSession, Session

async with AsyncSession(
    backend="niquests",           # curl_cffi / wreq / niquests / httpx
    impersonate="chrome152",
    proxy="http://user:pass@host:port",
    timeout=30,
    extra={"pool_maxsize": 1},    # 只传给当前库
) as s:
    r = await s.get(url, headers=headers)
    print(r.status_code, r.text, r.cookies, r.http_version)
    r = await s.post(url, data=body, headers=headers, header_order=["user-agent", "accept"])

s = Session(backend="wreq", impersonate="chrome149", proxy=proxy)
r = s.get(url, headers=headers)

extra= 会合并进底层构造函数或单次请求,后写覆盖统一层映射。底层 client 在 s.raw

niquests / httpx 默认带 Chrome 152 的 HTTP/2 SETTINGS、窗口和 HEADERS Priority,JA4 / peetprint / akamai_fingerprint 对齐真机。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tlsreq-0.1.0.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tlsreq-0.1.0-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file tlsreq-0.1.0.tar.gz.

File metadata

  • Download URL: tlsreq-0.1.0.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.11

File hashes

Hashes for tlsreq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f6d64cc1f508808b0dd1161e385d6b1cb732491cfddf9929f348c0633e3a0ab7
MD5 b96652ab79b040625fb4c53d0ba65c0c
BLAKE2b-256 a76eb78a6de362f8691946189bc2854b81c5eabccfb25a69dfad954419a9a2e1

See more details on using hashes here.

File details

Details for the file tlsreq-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tlsreq-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.11

File hashes

Hashes for tlsreq-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9ecf1d7f5b87e118def328f3b650b23791722d430072a8050902f3bffc6cbee
MD5 3fdc598d76e176d5e2d018f32deca612
BLAKE2b-256 d30af5c5b3599333ebc21dbe2bc5a6c1fd757c76d242fd63e9ab3b242785e021

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 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