API Contest.*

class cforces.methods.contest.Contest

Bases: object

async contest_hacks(contest_id: int, as_manager: bool | None = None) List[Hack]

Fetches hacks created during a contest.

Full information about hacks is available only after some time after the contest ends. During the contest, a user can only view his own hacks.

Parameters:
  • contest_id – ID of the contest. It’s not the round number. It can be seen in the contest URL. For example, in the following /contest/566/status <https://codeforces.com/contest/566/status>, the 566 is the contest ID.

  • as_manager – If set to true, the response will contain information available to contest managers. Otherwise, the response will contain only the information available to the participants. You must be a contest manager to use it.

Returns:

A list of hacks made during the requested contest.

async contest_list(gym: bool | None = None) List[Contest]

Retrieves the list of upcoming/finished contests.

Parameters:

gym – If true, then gym contests are returned. Otherwise, regular contests are returned.

Returns:

A list containing upcoming/finished contests.

async contest_rating_changes(contest_id: int) List[RatingChange]

Retrieves rating changes during a specific contest.

Parameters:

contest_id – ID of the contest. It’s not the round number. It can be seen in the contest URL. For example, in the following /contest/566/status <https://codeforces.com/contest/566/status>, the 566 is the contest ID.

Returns:

A list of rating changes that happened in the requested contest.

async contest_standings(contest_id: int, as_manager: bool = False, _from: int | None = None, count: int | None = None, handles: List[str] | str | None = None, room: int | None = None, show_unofficial: bool = False, participant_types: List[ParticipantType | str] | None = None) Standings

Retrieves standings of a specific contest.

This can return the standings of specific users using the handles parameter.

Parameters:
  • contest_id – ID of the contest. It’s not the round number. It can be seen in the contest URL. For example, in the following /contest/566/status <https://codeforces.com/contest/566/status>, the 566 is the contest ID.

  • as_manager – If set to true, the response will contain information available to contest managers. Otherwise, the response will contain only the information available to the participants. You must be a contest manager to use it.

  • _from – 1-based index of the first standings row that is going to be fetched. (Note: If you request specific users using handles, then this will indicate from where it should start searching)

  • count – Number of rows to return.

  • handles – List of handles. The API will not return information for more than 10000 handles.

  • room – If specified, then only participants from this room will be shown in the result.

  • show_unofficial – If true, then all participants are shown. Otherwise, only official contestants are shown.

  • participant_types – List of allowed participant types. Only participants with the specified types will be returned.

Returns:

A list of standings of the requested contest.

async contest_status(contest_id: int, as_manager: bool = False, handle: str | None = None, _from: int | None = None, count: int | None = None) List[Submission]

Retrieves submissions for a specific contest.

It can also fetch submissions of a specific user in the contest if the parameter handle is used.

Parameters:
  • contest_id – ID of the contest. It’s not the round number. It can be seen in the contest URL. For example, in the following /contest/566/status <https://codeforces.com/contest/566/status>, the 566 is the contest ID.

  • as_manager – If set to true, the response will contain information available to contest managers. Otherwise, the response will contain only the information available to the participants. You must be a contest manager to use it.

  • handle – If specified, returns the submissions in this contest of the user with this handle.

  • _from – 1-based index of the first standings row that is going to be retrieved.

  • count – Number of rows to return.

Returns:

A list of submission made during the requested contest.