Browse Source

Fix proxy argument

main
nibrag 7 years ago
parent
commit
7703160efc
1 changed files with 3 additions and 4 deletions
  1. +3
    -4
      README.rst

+ 3
- 4
README.rst View File

@@ -142,7 +142,6 @@ aiohttp usage
import asyncio
import aiohttp
import aiosocks
from yarl import URL
from aiosocks.connector import ProxyConnector, ProxyClientRequest


@@ -160,19 +159,19 @@ aiohttp usage
try:
with aiohttp.ClientSession(connector=conn, request_class=ProxyClientRequest) as session:
# socks5 proxy
async with session.get('http://github.com/', proxy=URL('socks5://127.0.0.1:1080'),
async with session.get('http://github.com/', proxy='socks5://127.0.0.1:1080',
proxy_auth=auth5) as resp:
if resp.status == 200:
print(await resp.text())

# socks4 proxy
async with session.get('http://github.com/', proxy=URL('socks4://127.0.0.1:1081'),
async with session.get('http://github.com/', proxy='socks4://127.0.0.1:1081',
proxy_auth=auth4) as resp:
if resp.status == 200:
print(await resp.text())

# http proxy
async with session.get('http://github.com/', proxy=URL('http://127.0.0.1:8080'),
async with session.get('http://github.com/', proxy='http://127.0.0.1:8080',
proxy_auth=ba) as resp:
if resp.status == 200:
print(await resp.text())


Loading…
Cancel
Save