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

httpx / niquests 会带上 PyPI 的 xutls(Chrome 152,import 名仍是 utls)。不要再装官方 utls,两个包会抢同一个模块。

pip install xutls
# 或 python -m 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.2.tar.gz (21.9 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.2-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tlsreq-0.1.2.tar.gz
Algorithm Hash digest
SHA256 179fe0c67b99914879402919fdf71ae1520a92c5056247eb18a0fd8c7da2874e
MD5 34a54d2c1cccb389c195deb2cf130cbc
BLAKE2b-256 ce382ecd2f6d7875b0a2f18b0ce5ff2668573a31538de1a7800401a0e6ace8b3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tlsreq-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 23e9682604652a69cf2c9ee7030d122a80b8ea32dc98ee538cfa17a8ad9333a9
MD5 1788a651c0cbefc7e9bb90dc07d78763
BLAKE2b-256 8d70d9eadd8cb4a40e5907eaef3666adef4e3d7497e4bac68d23926f10905fb0

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

This release

0.1.2 This release

2 files

0.1.1

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