testing proxies formatting
This commit is contained in:
1 parent
fb93073a9a
commit
800bf1d449
1 file changed
+13
-1
+13
-1
@@ -28,8 +28,20 @@ def get_bot_token(is_production: bool) -> str:
|
|||||||
|
|
||||||
@cache
|
@cache
|
||||||
def get_proxies() -> list[str]:
|
def get_proxies() -> list[str]:
|
||||||
|
parts = p.strip().split(":")
|
||||||
|
print(len(parts), parts)
|
||||||
with PROXIES_PATH.open() as f:
|
with PROXIES_PATH.open() as f:
|
||||||
proxies = [f"http://{p.strip()}" for p in f if p.strip()]
|
proxies = []
|
||||||
|
for p in f:
|
||||||
|
if not p.strip():
|
||||||
|
continue
|
||||||
|
|
||||||
|
parts = p.strip().split(":")
|
||||||
|
if len(parts) == 4:
|
||||||
|
host, port, user, password = parts
|
||||||
|
proxies.append(f"http://{user}:{password}@{host}:{port}")
|
||||||
|
else:
|
||||||
|
proxies.append(f"http://{p.strip()}")
|
||||||
|
|
||||||
if not proxies:
|
if not proxies:
|
||||||
raise ValueError("Proxy list cannot be empty")
|
raise ValueError("Proxy list cannot be empty")
|
||||||
|
|||||||
Reference in new issue
Block a user