-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
2 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ It uses [python-socks](https://github.com/romis2012/python-socks) for core proxy | |
## Requirements | ||
- Python >= 3.8 | ||
- aiohttp >= 3.10.0 | ||
- python-socks[asyncio] >= 1.0.1 | ||
- python-socks[asyncio] >= 2.4.3 | ||
|
||
## Installation | ||
``` | ||
|
@@ -39,7 +39,7 @@ async def fetch(url): | |
# port=1080, | ||
# username='user', | ||
# password='password', | ||
# rdns=True | ||
# rdns=True # default is True for socks5 | ||
# ) | ||
|
||
### proxy chaining (since ver 0.3.3) | ||
|
@@ -53,25 +53,6 @@ async def fetch(url): | |
return await response.text() | ||
``` | ||
|
||
#### aiohttp-socks also provides `open_connection` and `create_connection` functions: | ||
|
||
```python | ||
from aiohttp_socks import open_connection | ||
|
||
async def fetch(): | ||
reader, writer = await open_connection( | ||
proxy_url='socks5://user:[email protected]:1080', | ||
host='check-host.net', | ||
port=80 | ||
) | ||
request = (b"GET /ip HTTP/1.1\r\n" | ||
b"Host: check-host.net\r\n" | ||
b"Connection: close\r\n\r\n") | ||
|
||
writer.write(request) | ||
return await reader.read(-1) | ||
``` | ||
|
||
## Why yet another SOCKS connector for aiohttp | ||
|
||
Unlike [aiosocksy](https://github.com/romis2012/aiosocksy), aiohttp_socks has only single point of integration with aiohttp. | ||
|