🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

rnet

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rnet

A blazing-fast Python HTTP client with TLS fingerprint

2.2.8
PyPI
Maintainers
1

rnet

CI PyPI - License Python Version from PEP 621 TOML PyPI PyPI Downloads

🚀 Help me work seamlessly with open source sharing by sponsoring me on GitHub

A blazing-fast Python HTTP Client with advanced browser fingerprinting. Precisely emulates Chrome, Firefox, Safari, and OkHttp, accurately replicating TLS/HTTP2 signatures. Built on rquest for exceptional speed and a clean, intuitive API.

Features

  • Async and Blocking Clients
  • Plain bodies, JSON, urlencoded, multipart
  • Cookie Store
  • Header Order
  • Redirect Policy
  • Rotating Proxies
  • Connection Pooling
  • Streaming Transfers
  • Zero-Copy Transfers
  • WebSocket Upgrade
  • Async DNS Resolver
  • HTTPS via BoringSSL
  • Free-Threaded Safety
  • Automatic Decompression

Example

This asynchronous example demonstrates how to make a simple GET request using the rnet library. So you need install rnet and run the following code:

pip install asyncio rnet

And then the code:

import asyncio
from rnet import Impersonate, Client


async def main():
    # Build a client
    client = Client(impersonate=Impersonate.Firefox136)

    # Use the API you're already familiar with
    resp = await client.get("https://tls.peet.ws/api/all")
    
    # Print the response
    print(await resp.text())


if __name__ == "__main__":
    asyncio.run(main())

Additional learning resources include:

Platforms

  • Linux
  • glibc >= 2.34: x86_64, aarch64, armv7, i686
  • musl: x86_64, aarch64, armv7, i686
  • macOS: x86_64,aarch64

  • Windows: x86_64,i686,aarch64

Building

  • Install environment
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
pip install maturin
pip install uv

uv venv
source .venv/bin/activate
  • Development
maturin develop --uv
python3 examples/client.py
  • Compile wheels
  • Local Compilation

Install the BoringSSL build environment by referring to boring and boringssl.

maturin build --release
  • Musllinux

Also install the Docker environment. The image might be outdated, so if building the image yourself is required, refer to rust-cross-musl and the upstream rust-cross-musl. The upstream rust-cross-musl lacks the relevant platform linker environment variables, which must be added manually.

bash .github/musl_build.sh x86_64-unknown-linux-musl
bash .github/musl_build.sh aarch64-unknown-linux-musl
bash .github/musl_build.sh armv7-unknown-linux-musleabihf
bash .github/musl_build.sh i686-unknown-linux-musl
  • Manylinux

For Manylinux compilation, refer to manylinux.

Impersonate

In fact, most device models share the same TLS/HTTP2 configuration, with the main difference being the User-Agent.

BrowserVersions
ChromeChrome100, Chrome101, Chrome104, Chrome105, Chrome106, Chrome107, Chrome108, Chrome109, Chrome110, Chrome114, Chrome116, Chrome117, Chrome118, Chrome119, Chrome120, Chrome123, Chrome124, Chrome126, Chrome127, Chrome128, Chrome129, Chrome130, Chrome131, Chrome132, Chrome133, Chrome134
EdgeEdge101, Edge122, Edge127, Edge131, Edge134
SafariSafariIos17_2, SafariIos17_4_1, SafariIos16_5, Safari15_3, Safari15_5, Safari15_6_1, Safari16, Safari16_5, Safari17_0, Safari17_2_1, Safari17_4_1, Safari17_5, Safari18, SafariIPad18, Safari18_2, Safari18_1_1, Safari18_3, Safari18_3_1
OkHttpOkHttp3_9, OkHttp3_11, OkHttp3_13, OkHttp3_14, OkHttp4_9, OkHttp4_10, OkHttp4_12, OkHttp5
FirefoxFirefox109, Firefox117, Firefox128, Firefox133, Firefox135, FirefoxPrivate135, FirefoxAndroid135, Firefox136, FirefoxPrivate136

Contributing

If you would like to submit your contribution, please open a Pull Request.

Sponsors

CapSolver leverages AI-powered Auto Web Unblock to bypass Captchas effortlessly, providing fast, reliable, and cost-effective data access with seamless integration into Colly, Puppeteer, and Playwright—use code RNET for a 6% bonus!

License

rnet © 0x676e67, Released under the GPL-3.0 License.

Keywords

http

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts