Skip to content

Instantly share code, notes, and snippets.

@hereismari
Last active January 16, 2018 21:49
Show Gist options
  • Select an option

  • Save hereismari/0cdf5467ef7fe0417e4abe9ad7825dfc to your computer and use it in GitHub Desktop.

Select an option

Save hereismari/0cdf5467ef7fe0417e4abe9ad7825dfc to your computer and use it in GitHub Desktop.
import json
from urllib2 import Request, urlopen
html = Request('http://codeforces.com/api/problemset.problems')
response = urlopen(html)
x = response.read()
data = json.loads(x)
print len(data['result']['problems']) # dict with data from ~ 3912 problems
html = Request('http://codeforces.com/api/user.ratedList')
response = urlopen(html)
x = response.read()
d = json.loads(x)
print len(d['result']) # list with data from ~ 123418 users
html = Request('http://codeforces.com/api/user.ratedList?activeOnly=true')
response = urlopen(html)
x = response.read()
d = json.loads(x)
print len(d['result']) # list with data from ~ 17141 users that participated in recent contests (last month)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment