Skip to content

Commit 2ed6f08

Browse files
authored
chore: fix docs examples (#573)
1 parent e0cc1fd commit 2ed6f08

3 files changed

Lines changed: 8 additions & 21 deletions

File tree

docs/source/guide/proxy.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ client = Client(proxies=[proxy])
7474
```python
7575
# SOCKS5
7676
client = Client(
77-
proxies=[Proxy.http("socks5://username:password@127.0.0.1:1080")]
77+
proxies=[Proxy.all("socks5://username:password@127.0.0.1:1080")]
7878
)
7979

8080

8181
# SOCKS5h (DNS also resolved by the proxy)
8282
client = Client(
83-
proxies=[Proxy.http("socks5h://username:password@127.0.0.1:6152")]
83+
proxies=[Proxy.all("socks5h://username:password@127.0.0.1:6152")]
8484
)
8585
```
8686

@@ -100,8 +100,7 @@ from wreq import Proxy
100100
async def main():
101101
resp = await wreq.get(
102102
"https://httpbin.io/anything",
103-
proxies=[
104-
Proxy.all(
103+
proxy=Proxy.all(
105104
url="http://127.0.0.1:6152",
106105
custom_http_headers={
107106
"user-agent": "wreq",
@@ -110,7 +109,6 @@ async def main():
110109
"x-proxy": "wreq",
111110
},
112111
)
113-
],
114112
)
115113
print(await resp.text())
116114

@@ -133,24 +131,11 @@ from wreq import Proxy
133131
async def main():
134132
resp = await wreq.get(
135133
"http://localhost/v1.41/containers/json",
136-
proxies=[Proxy.unix("/var/run/docker.sock")],
134+
proxy=Proxy.unix("/var/run/docker.sock"),
137135
)
138136
print(await resp.text())
139137

140138
asyncio.run(main())
141139
```
142140

143141
Even though the URL says `http://localhost`, the request never touches the network. It goes directly through the socket file at the given path.
144-
145-
---
146-
147-
## Choosing the right constructor
148-
149-
Each constructor controls which requests are intercepted by the proxy:
150-
151-
| Constructor | Intercepts |
152-
|---|---|
153-
| `Proxy.all(url)` | All requests (HTTP + HTTPS) |
154-
| `Proxy.http(url)` | HTTP requests only |
155-
| `Proxy.https(url)` | HTTPS requests only |
156-
| `Proxy.unix(path)` | Requests via a Unix socket |

docs/source/guide/websocket.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ async def recv_message(ws):
9696

9797
async def main():
9898
# Connect to HTTP/2 WebSocket server
99-
client = wreq.Client(verify=False)
99+
client = wreq.Client(tls_verify=False)
100100
ws: WebSocket = await client.websocket(
101101
"wss://127.0.0.1:3000/ws",
102102
version=Version.HTTP_2

tests/multipart_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ async def test_reuse_multipart_with_clonable_parts():
2121
form = Multipart(
2222
Part(name="a", value="1"),
2323
Part(name="b", value=b"2"),
24-
Part(name="c", value=Path("./README.md"), filename="README.md", mime="text/plain"),
24+
Part(
25+
name="c", value=Path("./README.md"), filename="README.md", mime="text/plain"
26+
),
2527
)
2628

2729
for _ in range(3):

0 commit comments

Comments
 (0)