добавил удаление
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-04-19 19:13:57 +10:00
parent 9e6e1e3c98
commit 92cb60aa1d
2 changed files with 30 additions and 3 deletions

11
main.py
View File

@@ -100,6 +100,7 @@ def fetch_with_proxy(url, proxy, verify, timeout):
return None
except:
return None
# Перемешивает список прокси для случайного начала
def get_shuffled_proxies(proxies_list):
shuffled = proxies_list.copy()
@@ -483,6 +484,8 @@ async def process_parser_two_ist(background_tasks: BackgroundTasks):
class Parserall(BaseModel):
url: HttpUrl
promt: str
class Parserall_url(BaseModel):
url: HttpUrl
@app.post("/add_sources" , summary="Добавление парсинга любого источника")
async def add_sources_all_ist(sources: Parserall):
@@ -493,6 +496,10 @@ async def add_sources_all_ist(sources: Parserall):
async def get_all_sources():
return wp.get_all_sources()
@app.delete("/delete_sources", summary="Метод удаления источника")
async def delete_sources(url: str):
return print(wp.delete_sources(url))
@app.post("/parser_all" , summary="Запуск процеса парсинга любого источника")
async def process_parser_all_ist(url: Parserall, background_tasks: BackgroundTasks):
background_tasks.add_task(start_pars_all_istochnik, str(url.url), url.promt)
@@ -630,6 +637,6 @@ async def get_logs():
lines = file.readlines()[-10:] # последние 10 строк
return {"logs": lines}
# if __name__ == "__main__":
# uvicorn.run("main:app", port=8001, reload=True)
if __name__ == "__main__":
uvicorn.run("main:app", port=8001, reload=True)