добавил атостарт всех сайтов
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -409,6 +409,25 @@ def get_all_sources(category: str):
|
||||
return {"error": str(e), "sources": []}
|
||||
|
||||
|
||||
def get_true_sources():
|
||||
"""Возвращает все записи из таблицы sourse. Сначала показываются записи со status=true"""
|
||||
conn = get_connection()
|
||||
try:
|
||||
with conn.cursor(cursor_factory=RealDictCursor) as cur:
|
||||
cur.execute("""
|
||||
SELECT * FROM sourse
|
||||
WHERE status = true
|
||||
""")
|
||||
rows = cur.fetchall()
|
||||
sources = {}
|
||||
for row in rows:
|
||||
sources.update({row["url"]: row["promt"]})
|
||||
return sources
|
||||
except Exception as e:
|
||||
print(f"Ошибка при получении источников: {e}")
|
||||
return {"error": str(e), "sources": []}
|
||||
|
||||
|
||||
def update_source_status(url: str, status: bool = True):
|
||||
"""Обновляет статус источника по URL"""
|
||||
conn = get_connection()
|
||||
|
||||
Reference in New Issue
Block a user