Skip to content

Commit c87a163

Browse files
authoredMar 26, 2025
fix(proxy): fix typo (#169)
* fix(proxy): fix typo * delete badssl test
1 parent 312b249 commit c87a163

File tree

5 files changed

+22
-52
lines changed

5 files changed

+22
-52
lines changed
 

‎examples/proxy.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ async def main():
88
"https://httpbin.org/anything",
99
proxy=Proxy.all(
1010
url="http://127.0.0.1:6152",
11-
custom_httt_headers={
11+
custom_http_headers={
1212
"user-agent": "rnet",
1313
"accept": "*/*",
1414
"accept-encoding": "gzip, deflate, br",

‎rnet.pyi

+3-3
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ class Proxy:
16071607
Supports HTTP, HTTPS, SOCKS4, SOCKS4a, SOCKS5, and SOCKS5h protocols.
16081608
"""
16091609
@staticmethod
1610-
def http(url:builtins.str, username:typing.Optional[builtins.str]=None, password:typing.Optional[builtins.str]=None, custom_http_auth:typing.Optional[builtins.str]=None, custom_httt_headers:typing.Optional[typing.Union[typing.Dict[str, str], HeaderMap]]=None, exclusion:typing.Optional[builtins.str]=None) -> Proxy:
1610+
def http(url:builtins.str, username:typing.Optional[builtins.str]=None, password:typing.Optional[builtins.str]=None, custom_http_auth:typing.Optional[builtins.str]=None, custom_http_headers:typing.Optional[typing.Union[typing.Dict[str, str], HeaderMap]]=None, exclusion:typing.Optional[builtins.str]=None) -> Proxy:
16111611
r"""
16121612
Creates a new HTTP proxy.
16131613
@@ -1636,7 +1636,7 @@ class Proxy:
16361636
...
16371637

16381638
@staticmethod
1639-
def https(url:builtins.str, username:typing.Optional[builtins.str]=None, password:typing.Optional[builtins.str]=None, custom_http_auth:typing.Optional[builtins.str]=None, custom_httt_headers:typing.Optional[typing.Union[typing.Dict[str, str], HeaderMap]]=None, exclusion:typing.Optional[builtins.str]=None) -> Proxy:
1639+
def https(url:builtins.str, username:typing.Optional[builtins.str]=None, password:typing.Optional[builtins.str]=None, custom_http_auth:typing.Optional[builtins.str]=None, custom_http_headers:typing.Optional[typing.Union[typing.Dict[str, str], HeaderMap]]=None, exclusion:typing.Optional[builtins.str]=None) -> Proxy:
16401640
r"""
16411641
Creates a new HTTPS proxy.
16421642
@@ -1665,7 +1665,7 @@ class Proxy:
16651665
...
16661666

16671667
@staticmethod
1668-
def all(url:builtins.str, username:typing.Optional[builtins.str]=None, password:typing.Optional[builtins.str]=None, custom_http_auth:typing.Optional[builtins.str]=None, custom_httt_headers:typing.Optional[typing.Union[typing.Dict[str, str], HeaderMap]]=None, exclusion:typing.Optional[builtins.str]=None) -> Proxy:
1668+
def all(url:builtins.str, username:typing.Optional[builtins.str]=None, password:typing.Optional[builtins.str]=None, custom_http_auth:typing.Optional[builtins.str]=None, custom_http_headers:typing.Optional[typing.Union[typing.Dict[str, str], HeaderMap]]=None, exclusion:typing.Optional[builtins.str]=None) -> Proxy:
16691669
r"""
16701670
Creates a new proxy for all protocols.
16711671

‎src/typing/proxy.rs

+18-15
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ impl Proxy {
2424
/// * `url` - The URL of the proxy server.
2525
/// * `username` - Optional username for proxy authentication.
2626
/// * `password` - Optional password for proxy authentication.
27-
/// * `custom_http_auth` - Optional custom HTTP authentication header value.
27+
/// * `custom_http_auth` - Optional custom HTTP proxy authentication header value.
28+
/// * `custom_http_headers` - Optional custom HTTP proxy headers.
2829
/// * `exclusion` - Optional list of domains to exclude from proxying.
2930
///
3031
/// # Returns
@@ -44,7 +45,7 @@ impl Proxy {
4445
username = None,
4546
password = None,
4647
custom_http_auth = None,
47-
custom_httt_headers = None,
48+
custom_http_headers = None,
4849
exclusion = None,
4950
))]
5051
#[inline]
@@ -53,7 +54,7 @@ impl Proxy {
5354
username: Option<&str>,
5455
password: Option<&str>,
5556
custom_http_auth: Option<&str>,
56-
custom_httt_headers: Option<HeaderMapFromPy>,
57+
custom_http_headers: Option<HeaderMapFromPy>,
5758
exclusion: Option<&str>,
5859
) -> PyResult<Self> {
5960
Self::create_proxy(
@@ -62,7 +63,7 @@ impl Proxy {
6263
username,
6364
password,
6465
custom_http_auth,
65-
custom_httt_headers,
66+
custom_http_headers,
6667
exclusion,
6768
)
6869
}
@@ -76,7 +77,8 @@ impl Proxy {
7677
/// * `url` - The URL of the proxy server.
7778
/// * `username` - Optional username for proxy authentication.
7879
/// * `password` - Optional password for proxy authentication.
79-
/// * `custom_http_auth` - Optional custom HTTP authentication header value.
80+
/// * `custom_http_auth` - Optional custom HTTP proxy authentication header value.
81+
/// * `custom_http_headers` - Optional custom HTTP proxy headers.
8082
/// * `exclusion` - Optional list of domains to exclude from proxying.
8183
///
8284
/// # Returns
@@ -96,7 +98,7 @@ impl Proxy {
9698
username = None,
9799
password = None,
98100
custom_http_auth = None,
99-
custom_httt_headers = None,
101+
custom_http_headers = None,
100102
exclusion = None,
101103
))]
102104
#[inline]
@@ -105,7 +107,7 @@ impl Proxy {
105107
username: Option<&str>,
106108
password: Option<&str>,
107109
custom_http_auth: Option<&str>,
108-
custom_httt_headers: Option<HeaderMapFromPy>,
110+
custom_http_headers: Option<HeaderMapFromPy>,
109111
exclusion: Option<&str>,
110112
) -> PyResult<Self> {
111113
Self::create_proxy(
@@ -114,7 +116,7 @@ impl Proxy {
114116
username,
115117
password,
116118
custom_http_auth,
117-
custom_httt_headers,
119+
custom_http_headers,
118120
exclusion,
119121
)
120122
}
@@ -128,7 +130,8 @@ impl Proxy {
128130
/// * `url` - The URL of the proxy server.
129131
/// * `username` - Optional username for proxy authentication.
130132
/// * `password` - Optional password for proxy authentication.
131-
/// * `custom_http_auth` - Optional custom HTTP authentication header value.
133+
/// * `custom_http_auth` - Optional custom HTTP proxy authentication header value.
134+
/// * `custom_http_headers` - Optional custom HTTP proxy headers.
132135
/// * `exclusion` - Optional list of domains to exclude from proxying.
133136
///
134137
/// # Returns
@@ -148,7 +151,7 @@ impl Proxy {
148151
username = None,
149152
password = None,
150153
custom_http_auth = None,
151-
custom_httt_headers = None,
154+
custom_http_headers = None,
152155
exclusion = None,
153156
))]
154157
#[inline]
@@ -157,7 +160,7 @@ impl Proxy {
157160
username: Option<&str>,
158161
password: Option<&str>,
159162
custom_http_auth: Option<&str>,
160-
custom_httt_headers: Option<HeaderMapFromPy>,
163+
custom_http_headers: Option<HeaderMapFromPy>,
161164
exclusion: Option<&str>,
162165
) -> PyResult<Self> {
163166
Self::create_proxy(
@@ -166,7 +169,7 @@ impl Proxy {
166169
username,
167170
password,
168171
custom_http_auth,
169-
custom_httt_headers,
172+
custom_http_headers,
170173
exclusion,
171174
)
172175
}
@@ -179,7 +182,7 @@ impl Proxy {
179182
username: Option<&'a str>,
180183
password: Option<&str>,
181184
custom_http_auth: Option<&'a str>,
182-
custom_httt_headers: Option<HeaderMapFromPy>,
185+
custom_http_headers: Option<HeaderMapFromPy>,
183186
exclusion: Option<&'a str>,
184187
) -> PyResult<Self> {
185188
let mut proxy = proxy_fn(url).map_err(Error::RquestError)?;
@@ -194,8 +197,8 @@ impl Proxy {
194197
}
195198

196199
// Convert the custom HTTP headers to a HeaderMap instance.
197-
if let Some(custom_httt_headers) = custom_httt_headers {
198-
proxy = proxy.custom_http_headers(custom_httt_headers.0)
200+
if let Some(custom_http_headers) = custom_http_headers {
201+
proxy = proxy.custom_http_headers(custom_http_headers.0)
199202
}
200203

201204
// Convert the exclusion list to a NoProxy instance.

‎tests/badssl_test.py

-12
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,3 @@ async def test_badssl():
1212
client.update(impersonate=rnet.Impersonate.Chrome100)
1313
resp = await client.get("https://self-signed.badssl.com/")
1414
assert resp.status == 200
15-
16-
17-
@pytest.mark.asyncio
18-
@pytest.mark.flaky(reruns=3, reruns_delay=2)
19-
async def test_custom_certs():
20-
client = rnet.Client(verify="tests/certs/badssl.pem")
21-
resp = await client.get("https://self-signed.badssl.com/")
22-
assert resp.status == 200
23-
24-
client.update(impersonate=rnet.Impersonate.Chrome100)
25-
resp = await client.get("https://self-signed.badssl.com/")
26-
assert resp.status == 200

‎tests/certs/badssl.pem

-21
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.