onlinejudge.service.codeforces module

the module for Codeforces (https://codeforces.com/)

note

There is the offcial API https://codeforces.com/api/help

class onlinejudge.service.codeforces.CodeforcesContest(*, contest_id, kind=None)[source]

Bases: onlinejudge.type.Contest

Variables
  • contest_idint

  • kindstr must be contest or gym

download_data(*, session=None)[source]
Return type

CodeforcesContestData

classmethod from_url(url)[source]
Return type

Optional[CodeforcesContest]

get_service()[source]
Return type

CodeforcesService

get_url()[source]
Return type

str

list_problem_data(*, session=None)[source]
Return type

List[CodeforcesProblemData]

list_problems(*, session=None)[source]
Return type

List[CodeforcesProblem]

class onlinejudge.service.codeforces.CodeforcesContestData(*, contest, duration_seconds, frozen, name, phase, relative_time_seconds, response, session, start_time_seconds, timestamp, type)[source]

Bases: onlinejudge.type.ContestData

property contest
Return type

CodeforcesContest

property json
Return type

bytes

property name
Return type

str

property response
Return type

Response

property session
Return type

Session

property timestamp
Return type

datetime

class onlinejudge.service.codeforces.CodeforcesProblem(*, contest_id, index, kind=None)[source]

Bases: onlinejudge.type.Problem

Variables
  • contest_idint

  • indexstr

  • kindstr must be contest or gym

download_data(*, session=None)[source]
Return type

CodeforcesProblemData

download_sample_cases(*, session=None)[source]
Raises

SampleParseError

Return type

List[TestCase]

classmethod from_url(url)[source]
Return type

Optional[CodeforcesProblem]

get_available_languages(*, session=None)[source]
Raises

NotLoggedInError

Return type

List[Language]

get_contest()[source]
Return type

CodeforcesContest

get_service()[source]
Return type

CodeforcesService

get_url()[source]
Return type

str

submit_code(code, language_id, *, filename=None, session=None)[source]
Raises
Return type

Submission

class onlinejudge.service.codeforces.CodeforcesProblemData(*, name, points, problem, rating, response, session, tags, timestamp, type)[source]

Bases: onlinejudge.type.ProblemData

property json
Return type

bytes

property name

for example of Problem:

  • 器物損壊!高橋君

  • AtCoDeerくんと変なじゃんけん / AtCoDeer and Rock-Paper

  • Xor Sum

Return type

str

property problem
Return type

CodeforcesProblem

property response
Return type

Response

property session
Return type

Session

property timestamp
Return type

datetime

class onlinejudge.service.codeforces.CodeforcesService[source]

Bases: onlinejudge.type.Service

classmethod from_url(url)[source]
Return type

Optional[CodeforcesService]

get_name()[source]

example:

  • AtCoder

  • Codeforces

  • PKU JudgeOnline

Note

If you want something like identifier (e.g. atcoder, codeforces or poj), you can use a domain obtained from get_url().

Return type

str

get_url()[source]
Return type

str

get_url_of_login_page()[source]
Return type

str

is_logged_in(*, session=None)[source]
Return type

bool

iterate_contest_data(*, is_gym=False, session=None)[source]
Return type

Iterator[CodeforcesContestData]

iterate_contests(*, is_gym=False, session=None)[source]
Return type

Iterator[CodeforcesContest]

login(*, get_credentials, session=None)[source]
Raises

LoginError

Return type

None