tlsreq
把 curl_cffi、wreq、niquests+utls、httpx+utls 收成同一套 Session API。换库只改 backend 和 impersonate。
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
179fe0c67b99914879402919fdf71ae1520a92c5056247eb18a0fd8c7da2874e
|
|
| MD5 |
34a54d2c1cccb389c195deb2cf130cbc
|
|
| BLAKE2b-256 |
ce382ecd2f6d7875b0a2f18b0ce5ff2668573a31538de1a7800401a0e6ace8b3
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23e9682604652a69cf2c9ee7030d122a80b8ea32dc98ee538cfa17a8ad9333a9
|
|
| MD5 |
1788a651c0cbefc7e9bb90dc07d78763
|
|
| BLAKE2b-256 |
8d70d9eadd8cb4a40e5907eaef3666adef4e3d7497e4bac68d23926f10905fb0
|