Skip to content

Instantly share code, notes, and snippets.

@Muaath5
Created September 29, 2025 11:13
Show Gist options
  • Select an option

  • Save Muaath5/7b63b133879296ff0025fe3e71d17af7 to your computer and use it in GitHub Desktop.

Select an option

Save Muaath5/7b63b133879296ff0025fe3e71d17af7 to your computer and use it in GitHub Desktop.
CMS Live submissions monitoring in Python
import requests
import time
import datetime
import os
ROOT_URL = 'https://ranking.ioi2025.bo/'
session = requests.session()
session.get(ROOT_URL)
def load_user(usr):
url = f'{ROOT_URL}sublist/{usr}'
resp = session.get(url)
if resp.status_code != 200:
print(f"Error {resp.status_code}")
return []
return resp.json()
IMP = ['SAU1', 'SAU2', 'SAU3', 'SAU4']
status = {u: 0 for u in IMP}
def update_status():
for usr in IMP:
res = load_user(usr)
res = sorted(res, key=lambda x: x['time'])
if len(res) > status[usr]:
# TODO: Beep a sound
# os.system("echo -e \'\\a\'")
for i in range(status[usr], len(res)):
dd = datetime.datetime.fromtimestamp(res[i]['time'])
print(f'{res[i]['user']} at {dd.strftime('%H:%M:%S')} at {res[i]['task']} has {res[i]['extra']}')
status[usr] = len(res)
print('-'*10)
update_status()
print("="*20)
while True:
update_status()
time.sleep(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment