Update app.py
Browse files
app.py
CHANGED
|
@@ -22,8 +22,21 @@ import uvicorn
|
|
| 22 |
from contextlib import asynccontextmanager
|
| 23 |
import os
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
bot = Bot(token=os.getenv('BOT_TOKEN'),
|
| 26 |
-
default=DefaultBotProperties(parse_mode=ParseMode.HTML)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
dp = Dispatcher()
|
| 28 |
|
| 29 |
@asynccontextmanager
|
|
|
|
| 22 |
from contextlib import asynccontextmanager
|
| 23 |
import os
|
| 24 |
|
| 25 |
+
from aiohttp_socks import SocksConnector
|
| 26 |
+
# Define your SOCKS proxy
|
| 27 |
+
socks_proxy = "socks5://127.0.0.1:9050"
|
| 28 |
+
|
| 29 |
+
# Create a connector with SOCKS proxy and rdns=True for DNS resolution
|
| 30 |
+
connector = SocksConnector.from_url(socks_proxy, rdns=True)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
bot = Bot(token=os.getenv('BOT_TOKEN'),
|
| 34 |
+
default=DefaultBotProperties(parse_mode=ParseMode.HTML))
|
| 35 |
+
|
| 36 |
+
# Create a session with the custom connector
|
| 37 |
+
session = bot.session
|
| 38 |
+
session.connector = connector
|
| 39 |
+
|
| 40 |
dp = Dispatcher()
|
| 41 |
|
| 42 |
@asynccontextmanager
|