Spaces:
Runtime error
Runtime error
File size: 566 Bytes
9d61592 93e79d1 9d61592 93e79d1 9d61592 93e79d1 9d61592 93e79d1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import requests
import json
import os
def run_cf_sync():
# 1. Fetch data from Codeforces
c_resp = requests.get("https://codeforces.com/api/contest.list?gym=false")
contests = [c for c in c_resp.json()['result'] if c.get('phase') == "FINISHED"]
# 2. Logic to group/process (Simplified for example)
output_filename = "cf_contests.json"
with open(output_filename, "w") as f:
json.dump(contests[:50], f) # Limit for speed
# 3. Return the absolute path so Gradio can find the file
return os.path.abspath(output_filename) |