Rnet: Blazing-Fast HTTP Client with TLS Fingerprinting
Rnet is a high-performance Python HTTP client built with Rust bindings, specializing in advanced TLS fingerprinting. It accurately emulates the TLS and HTTP/2 signatures of various popular browsers like Chrome, Firefox, Safari, Opera, and OkHttp, enabling it to bypass sophisticated anti-bot detection systems. Rnet provides both asynchronous and synchronous client interfaces and is designed for speed and reliability in web scraping, API testing, and automation tasks. The current stable version is 2.4.2, with active development on 3.x release candidates, indicating a continuous and rapid release cadence.
Warnings
- breaking The `Impersonate` enum, used to specify browser profiles for TLS fingerprinting, has been renamed to `Emulation` in `v3.x` release candidates. Code written for `v2.x` using `Impersonate` will break when upgrading to `v3.x`.
- gotcha Version `3.0.0` of `rnet` is currently in a release candidate (RC) phase. While the API is stabilizing, minor changes may still occur before the final `3.0.0` stable release. Users should be aware of potential breaking changes when upgrading between RCs or to the final stable version.
- gotcha Building `rnet` from source (e.g., if pre-compiled wheels are not available for your specific platform/Python version) requires a Rust toolchain and a properly set up BoringSSL build environment. This can be complex to configure compared to a standard `pip install`.
Install
-
pip install rnet
Imports
- Client
from rnet import Client
- BlockingClient
from rnet import BlockingClient
- Impersonate
from rnet import Impersonate
Quickstart
import asyncio
from rnet import Client, Impersonate
async def main():
# Build a client impersonating Firefox 139
client = Client(impersonate=Impersonate.Firefox139)
# Make a GET request
resp = await client.get("https://tls.peet.ws/api/all")
# Print the response status and text
print(f"Status: {resp.status_code}")
print(await resp.text())
if __name__ == "__main__":
asyncio.run(main())