added proxy managament from dsqls module
This commit is contained in:
1 parent
4f7dd161ef
commit
4978b9d194
2 files changed
-25
No files matched your search
@@ -29,28 +29,6 @@ def get_bot_token(is_production: bool) -> str:
|
||||
return DEVELOPMENT_BOT_TOKEN
|
||||
|
||||
|
||||
@cache
|
||||
def get_proxies() -> list[str]:
|
||||
with PROXIES_PATH.open() as f:
|
||||
proxies = []
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
|
||||
parts = line.split(":", 3)
|
||||
if len(parts) == 4 and not parts[1].startswith("//"):
|
||||
host, port, user, password = parts
|
||||
proxies.append(f"http://{user}:{password}@{host}:{port}")
|
||||
else:
|
||||
proxies.append(f"http://{line}")
|
||||
|
||||
if not proxies:
|
||||
raise ValueError("Proxy list cannot be empty")
|
||||
|
||||
return proxies
|
||||
|
||||
|
||||
def get_config(
|
||||
monitor_name: str, use_production_path: bool = False
|
||||
) -> tuple[dict, pathlib.Path]:
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import asyncio
|
||||
import pathlib
|
||||
from json import JSONDecodeError
|
||||
|
||||
import aiohttp
|
||||
@@ -7,8 +6,6 @@ import requests
|
||||
from curl_cffi.requests.errors import RequestsError
|
||||
from pymongo.errors import PyMongoError
|
||||
|
||||
PROJECT_ROOT = pathlib.Path(".")
|
||||
PROXIES_PATH = pathlib.Path("proxies.txt")
|
||||
MONGO_DATABASE_NAME = "tpv_woot"
|
||||
MONGO_URL = (
|
||||
"mongodb://tpv:n3%23QI07GnbZCbvGJ@zelda.disqualifier.me:27017/?authSource=tpv_woot"
|
||||
|
||||
Reference in new issue
Block a user