| Crates.io | hyprcurl |
| lib.rs | hyprcurl |
| version | 0.1.0 |
| created_at | 2025-12-07 17:50:17.245834+00 |
| updated_at | 2025-12-07 17:50:17.245834+00 |
| description | A high-performance Rust HTTP client with browser impersonation and TLS fingerprinting |
| homepage | |
| repository | https://github.com/Aditya-PS-05/hyprcurl |
| max_upload_size | |
| id | 1971990 |
| size | 359,516 |
A high-performance Rust HTTP client with browser impersonation and TLS fingerprinting support.
Rust implementation inspired by Python's curl_cffi
cargo add hyprcurl
# Build from source
cargo build --release --features python
pip install maturin
maturin develop --release
use hyprcurl::{get, post};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Simple GET
let response = get("https://httpbin.org/get")?;
println!("{}", String::from_utf8_lossy(&response));
// Simple POST
let data = r#"{"key": "value"}"#;
let response = post("https://httpbin.org/post", data)?;
Ok(())
}
use hyprcurl::{Request, Browser};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// GET with browser impersonation
let response = Request::get("https://tls.browserleaks.com/json")
.impersonate(Browser::ChromeLatest)
.send()?;
// POST with browser impersonation and proxy
let response = Request::post("https://httpbin.org/post", r#"{"test": "data"}"#)
.impersonate(Browser::FirefoxLatest)
.proxies("socks5://localhost:1080")
.send()?;
Ok(())
}
use hyprcurl::{Curl, Browser, CurlOpt};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut curl = Curl::new()?;
// Configure request
curl.set_url("https://httpbin.org/get")?;
curl.set_browser_impersonation(Browser::ChromeLatest)?;
curl.add_header("X-Custom-Header: value")?;
curl.setopt_long(CurlOpt::Timeout, 30)?;
// Perform request
let mut buffer = Vec::new();
curl.perform(&mut buffer)?;
// Get response metadata
let status = curl.response_code()?;
let time = curl.total_time()?;
println!("Status: {}, Time: {:.2}s", status, time);
Ok(())
}
import hyprcurl
# Simple GET
response = hyprcurl.get("https://httpbin.org/get")
# GET with browser impersonation
response = hyprcurl.get(
"https://tls.browserleaks.com/json",
impersonate="chrome"
)
# POST with impersonation and proxy
response = hyprcurl.post(
"https://httpbin.org/post",
data='{"key": "value"}',
impersonate="firefox121",
proxies="socks5://localhost:1080"
)
Supported browsers:
Browser::ChromeLatest // Chrome 131
Browser::Chrome { version: 110 }
Browser::FirefoxLatest // Firefox 121
Browser::Firefox { version: 115 }
Browser::SafariLatest // Safari 18.0
Browser::Safari { version: "17.5".into() }
Browser::EdgeLatest // Edge 131
Browser::Edge { version: 120 }
Each browser impersonation sets:
Run the comprehensive test suite:
# Run all tests
cargo test
# Run integration tests (makes real HTTP requests)
cargo test --test integration_tests
# Run with output
cargo test -- --nocapture
Compare performance with Python curl_cffi:
cd benchmarks
uv init
uv add curl_cffi pandas matplotlib
uv run server.py
cargo build --release --features python
cp target/release/libhyprcurl.so target/release/hyprcurl.so
cd benchmarks
uv run python_vs_rust_bench.py
Results:
python_vs_rust_bench.csvpython_vs_rust_bench.pngBuild and view the comprehensive guide:
# Install mdBook
cargo install mdbook
# Build and serve the book
mdbook serve book --open
# Opens at http://localhost:3000
Generate Rust API docs:
# Standard docs
cargo doc --no-deps --open
# With all features
cargo doc --all-features --open
See the examples/ directory for complete working examples:
simple_get.rs - Basic GET requestsbrowser_impersonation.rs - All browser typesproxy_usage.rs - HTTP and SOCKS5 proxiespost_request.rs - POST with various optionscomprehensive.rs - Full feature showcaseRun examples:
cargo run --example simple_get
cargo run --example browser_impersonation
Inspired by curl_cffi - the excellent Python library for browser impersonation.