1 个不稳定版本
0.1.0 | 2024 年 6 月 12 日 |
---|
#6 在 #helps
3KB
brightdata-proxy
描述
一个简单的辅助库,帮助您设置 brightdata 代理,您可以与 reqwest 库一起使用。
示例
一个完整的示例可以在这里找到。
// Create a proxy builder
let proxy_builder = BrightdataProxyBuilder::builder()
.username(username)
.password(password)
.build();
// Create a new proxy
// 1 session = 1 ip, as long as you use the same client you'll keep the same IP
// NOTE: you can only keep the same ip for 60 seconds, see docs: https://docs.brightdata.com/api-reference/proxy/rotate_ips
let proxy = proxy_builder
.create_new_session()
.context("create new proxy session")?;
// Build your request client and use as usual
let client = ClientBuilder::new()
.proxy(proxy)
.build()
.context("build http client")?;
依赖项
~4–15MB
~198K SLoC