Skip to content

VadVergasov/CodeforcesApiPy

This branch is 7 commits ahead of, 1 commit behind master.

Folders and files

NameName
Last commit message
Last commit date
Oct 4, 2024
Jul 6, 2024
Jun 30, 2024
Sep 9, 2022
Mar 8, 2020
Mar 15, 2021
Mar 17, 2021
Jul 21, 2024
Feb 27, 2020
Jun 30, 2024

Repository files navigation

Codeforces API License Stars Forks Issues Publish to PyPI and create Release. Generate wiki Downloads Codestyle

Installing

With pip:

pip install CodeforcesApiPy

From the repository:

git clone https://github.com/VadVergasov/CodeforcesApiPy.git
cd codeforcesapipy
python3 setup.py install

Using

import codeforces_api

cf_api = codeforces_api.CodeforcesApi(api_key, secret) # Authorized access to api.
anonim_cf_api = codeforces_api.CodeforcesApi() # Unauthorized access to api.

parser = codeforces_api.CodeforcesParser() # Create parser.

Types

All types are defined in types.py. They are all completely in line with the Codeforces API's definition of the types

Methods

All API methods are located in the CodeforcesAPI class. They are renamed to follow common Python naming conventions. E.g. contest.hacks is renamed to contest_hacks and user.actions to user_actions.

Transferring to 2 version

In the second version, all objects are represented as a class, so if you want to get a handle of the user you need to do like this: user.handle. You can read about all fields on Codeforces API objects.

Wiki

Here is link to the wiki for more details.

Examples

Here are some examples of using this library:

  • A2OJ by subodhk01 - allows you to look at your ladder progress.
  • cf_utils by xennygrimmato - allows you to find common solved problems.