trio-socks
trio-socks provides a trio.abc.HalfCloseableStream that routes its traffic through a SOCKS proxy server
Example
import trio
from trio_socks import socks5
async def parse_public_ip(stream):
await stream.send_all('GET / HTTP/1.1\r\nHost: api.ipify.org\r\n\r\n'.encode())
text = (await stream.receive_some()).decode()
i = text.rfind('\r\n\r\n')
my_ip = text[i + 4:]
print(f'{my_ip=}')
async def print_public_ip():
async with socks5.Socks5Stream(destination=('api.ipify.org', 80), proxy=('10.179.205.114', 1664)) as stream:
await parse_public_ip(stream)
async with await trio.open_tcp_stream('api.ipify.org', 80) as stream:
await parse_public_ip(stream)
trio.run(print_public_ip)
Release files for trio-socks 0.1.1.post5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| trio-socks-0.1.1.post5.tar.gz | 5.6 kB | Details |
Release files / trio-socks-0.1.1.post5.tar.gz
| Download URL | trio-socks-0.1.1.post5.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e138c65853dba1e489e0673d9eee372c2676337cb91f83b0a8bb6a6b6310bbb
|
|
BLAKE2b-256 checksum How to use checksums |
68b3bfb1f20db26b0b8ca0fd7d995f374ba614df9e548b9d81aad7de7fc326ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.1
|