исправил недачеты

This commit is contained in:
2026-03-28 14:38:57 +10:00
parent a689e0b9da
commit 60224501ab

13
main.py
View File

@@ -6,6 +6,7 @@ import subprocess
import time
from datetime import datetime as dt
from datetime import datetime
import random
# Сторонние библиотеки (third-party)
from apscheduler.schedulers.asyncio import AsyncIOScheduler
@@ -86,15 +87,15 @@ def fetch_with_proxy(url, proxy, verify, timeout):
if response.status_code == 200:
# Проверяем содержимое - если это ошибка от прокси
if '"message":"Request failed' in response.text or '403' in response.text[:500]:
# print(f"Proxy {proxy} - Site returned 403 (inside response)")
print(f"Proxy {proxy} - Site returned 403 (inside response)")
return None
# print(f"Proxy {proxy} - SUCCESS")
print(f"Proxy {proxy} - SUCCESS")
return response.text
elif response.status_code == 403:
# print(f"Proxy {proxy} - 403 Forbidden")
print(f"Proxy {proxy} - 403 Forbidden")
return None # Прокси работает, но сайт блокирует
else:
# print(f"Proxy {proxy} - Status {response.status_code}")
print(f"Proxy {proxy} - Status {response.status_code}")
return None
except:
return None
@@ -442,5 +443,5 @@ async def download_file(path: str, title: str):
path = f"./{path}/{title}.docx" #os.path.abspath(path)
return FileResponse(path=path, filename=f'{title}.docx', media_type='multipart/form-data')
if __name__ == "__main__":
uvicorn.run("main:app", port=8001, reload=True)
# if __name__ == "__main__":
# uvicorn.run("main:app", port=8001, reload=True)