Fer22f

Times da Maratona

Nov 1st, 2020 (edited)
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. import requests
  2. import json
  3. sites = requests.get('https://icpc.global/cm5-contest-rest/rest/contest/public/South-America-Brazil-First-Phase-2020/sites').json()
  4. teams = []
  5. for site in sites:
  6.     print(f"Requesting site {site['name']}")
  7.     teams.extend([{**team, 'site': site} for team in requests.get(f'https://icpc.global/cm5-team/rest/team/table/site/accepted/{site["id"]}', { 'q': 'proj:institution,name', 'page': 1, 'size': 1000 }).json()])
  8. institutions = set([team['institution'] for team in teams])
  9. print(f'{len(institutions)} instituições')
  10. print(f'{len(teams)} times')
  11.  
  12. with open('teams.json', 'w') as f:
  13.     json.dump(teams, f)
  14.  
Add Comment
Please, Sign In to add comment