An async HTTP library based on surf (Go) with TLS fingerprinting support
Project description
🔥 Surf TLS
Surf TLS is an advanced async HTTP library based on surf (Go HTTP client) with TLS fingerprinting support.
Installation
pip install surf-tls
The library will automatically download the correct binary for your platform on first use. No manual building required!
Features
- Auto-updating: Downloads latest binaries from GitHub releases
- Async support
- Proxy support
- Custom JA3 string
- Custom JA3 Hello ID
- Custom H2 settings
- Custom header order
- HTTP/1.1, HTTP/2, and HTTP/3 support
-
requests'shistorysupport -
requests'sallow_redirectssupport - much more...
Quick Start
import asyncio
import surf_tls
async def main():
# Auto-download latest binaries (optional, happens automatically)
await surf_tls.download_if_necessary()
# Or check for updates
await surf_tls.update_if_necessary()
session = surf_tls.Session(ja3_hello_id="chrome_144")
res = await session.get("https://www.example.com/")
print(res.text)
asyncio.run(main())
Local Development
If you want to build locally for development:
# Build the shared library
./build.sh
# Install in development mode
pip install -e .
Examples
Example 1 - Basic usage:
import surf_tls
async def main():
session = surf_tls.Session(
ja3_hello_id="chrome_144"
)
res = await session.get(
"https://www.example.com/",
headers={
"key1": "value1",
},
proxy="http://user:password@host:port"
)
print(res.text)
asyncio.run(main())
Example 2 - Custom JA3:
import surf_tls
async def main():
session = surf_tls.Session(
ja3_string="771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513,29-23-24,0",
h2_settings={
"HEADER_TABLE_SIZE": 65536,
"MAX_CONCURRENT_STREAMS": 1000,
"INITIAL_WINDOW_SIZE": 6291456,
"MAX_HEADER_LIST_SIZE": 262144
},
header_order=[
"accept",
"user-agent",
"accept-encoding",
"accept-language"
]
)
res = await session.post(
"https://www.example.com/",
headers={
"key1": "value1",
},
proxy="http://user:password@host:port"
)
print(res.text)
asyncio.run(main())
Acknowledgments
Big shout out to enetx for open sourcing surf, an excellent Go HTTP client library.
Project details
Release history Release notifications | RSS feed
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 surf_tls-0.1.0.tar.gz.
File metadata
- Download URL: surf_tls-0.1.0.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c87d92950f54e3c2dbba51f6d68d0fd5ae050a359f980ffa10392d02ddc931f
|
|
| MD5 |
878a10d9d1d7c6d7617e842ba52d575b
|
|
| BLAKE2b-256 |
f24d67b0f10a212fad65e8ad715f8c5a226e4eb6d2356c630c1d9a4409c4d823
|
File details
Details for the file surf_tls-0.1.0-py3-none-any.whl.
File metadata
- Download URL: surf_tls-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83f3941e6794d44b143798788817eba1d63374641c2d16b6bdb6c68127038f0b
|
|
| MD5 |
c408c088cb7cc6ae280c6cd3f1744e15
|
|
| BLAKE2b-256 |
4c8b80cfaac1ee14efb9c044b22f7f5a76d363445efc3d365177d09169e1298f
|