/
Noriyki
/
VibeCodeBot
Обзор
Документация
Войти
/
Noriyki
/
VibeCodeBot
Код
Запросы
2
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
fronted_bot
src/services/CodeforceApi.py
28 строк
712 B
Noriyki
refactor(backend): объединение логики работы бота и Flask приложения
14 фев 2026, 14:46
14 фев 2026, 14:46
3b40564
Код
Авторство
О чём код?
import requests def get_all_problems(): """Получает все задачи с Codeforces""" try: url = "https://codeforces.com/api/problemset.problems" response = requests.get(url, timeout=10) response.raise_for_status() data = response.json() if data.get("status") != "OK": return None return data.get("result") except requests.exceptions.RequestException: return None except Exception: return None def get_problems_by_rating(rating: int): data = get_all_problems() if not data: return [] problems = data.get("problems", []) return [p for p in problems if p.get("rating") == rating]