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.1.tar.gz (22.5 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.1-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tlsreq-0.1.1.tar.gz
  • Upload date:
  • Size: 22.5 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.1.tar.gz
Algorithm Hash digest
SHA256 85c6e26fd00afb542d124fbba0d6c7e8efc7cf812300b1d1c4018d23134401d5
MD5 f142fe39b58638b95353a6baf3d654fe
BLAKE2b-256 6e6c25a59adc12788c967becf4141dc4c3edc31a0935a03c05b13ef0aebfb479

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tlsreq-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 24.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a04a11a48498934c7c9901530f4a4c2f7db13f5b848fc97a3560983b7eabeec6
MD5 75937d99fcbe86ac916ab717b1f98cdb
BLAKE2b-256 d1f744ff93a9bf5328a6094073a35340ea5fc41fba2515bb06c5c74516cf2d8f

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

This release

0.1.1 This release

2 files

0.1.0

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