OP 12 January, 2024 - 08:59 PM
[Project Type]: Golang proxy server
[Compensation]: 150$ - can be discussed
[Current Project State]: 95%
[Programming Language]: Golang
Need some help making my proxy work for AIOHTTP. The issue lies with the proxy server need some help making it for asynchronous clients.
Doesnt work:
```python
import aiohttp
import random
import asyncio
from aiohttp_proxy import ProxyConnector, ProxyType
async def fetch():
headers = {
'User-Agent': 'Mozilla/5.0 ... Safari/537.36',
}
connector = ProxyConnector.from_url('http://127.0.0.1:1337')
async with aiohttp.ClientSession(connector=connector) as session:
try:
async with session.get(
'https://google.com',
headers=headers, allow_redirects=False, timeout=10, ssl=False) as response:
text = await response.text()
print(text)
except Exception as e:
print(f"Error: {e}")
# Run the async function
asyncio.run(fetch())
```
Works:
```python
import requests
proxies = {
'http': 'http://127.0.0.1:1337',
'https': 'http://127.0.0.1:1337'
}
get = requests.get('https://google.com', proxies=proxies)
print(get.text)
````
https://t.me/ExiDev - scammers dont waste ur time
[Compensation]: 150$ - can be discussed
[Current Project State]: 95%
[Programming Language]: Golang
Need some help making my proxy work for AIOHTTP. The issue lies with the proxy server need some help making it for asynchronous clients.
Doesnt work:
```python
import aiohttp
import random
import asyncio
from aiohttp_proxy import ProxyConnector, ProxyType
async def fetch():
headers = {
'User-Agent': 'Mozilla/5.0 ... Safari/537.36',
}
connector = ProxyConnector.from_url('http://127.0.0.1:1337')
async with aiohttp.ClientSession(connector=connector) as session:
try:
async with session.get(
'https://google.com',
headers=headers, allow_redirects=False, timeout=10, ssl=False) as response:
text = await response.text()
print(text)
except Exception as e:
print(f"Error: {e}")
# Run the async function
asyncio.run(fetch())
```
Works:
```python
import requests
proxies = {
'http': 'http://127.0.0.1:1337',
'https': 'http://127.0.0.1:1337'
}
get = requests.get('https://google.com', proxies=proxies)
print(get.text)
````
https://t.me/ExiDev - scammers dont waste ur time