sourse
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-04-11 21:33:43 +10:00
parent 89da884e66
commit 662cfa0994
2 changed files with 5 additions and 6 deletions

View File

@@ -64,7 +64,7 @@ app.add_middleware(
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
expose_headers=["*"],
# expose_headers=["*"],
)
PROXIES_URL = "https://raw.githubusercontent.com/TheSpeedX/SOCKS-List/master/http.txt"
@@ -472,6 +472,7 @@ class Parserall(BaseModel):
@app.post("/add_sources" , summary="Добавление парсинга любого источника")
async def add_sources_all_ist(sources: Parserall):
print(f"Добавление источника: {sources.url} с промтом: {sources.promt}")
result = wp.add_sources(str(sources.url), sources.promt)
return {"status": "success", "message": "Источник добавлен", "data": result}
@@ -480,12 +481,10 @@ async def process_parser_all_ist(url: Parserall, background_tasks: BackgroundTas
background_tasks.add_task(start_pars_all_istochnik(str(url.url), url.promt))
return {"message": "Процесс парсинга любого источника запущен"}
# GET метод для получения
@app.get("/get_tasks_offset", summary="Метод получения задач парсинга")
async def get_tasks_offset(limit: int = Query(10, gt=0), offset: int = Query(0, ge=0)):
return wp.get_tasks_offset(limit, offset)
# GET метод для получения настроек
@app.get("/settings", summary="Метод получения настроек парсера")
async def get_settings():
return wp.get_all_promt()
@@ -614,5 +613,5 @@ 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)

View File

@@ -248,7 +248,7 @@ def add_sources(url: str, promt: str):
try:
with conn.cursor() as cur:
cur.execute("""
INSERT INTO config_gpt (url, promt)
INSERT INTO sourse (url, promt)
VALUES (%s, %s)
ON CONFLICT (url) DO UPDATE SET
promt = EXCLUDED.promt