Skip to main content

A Codeforces API wrapper

Project description

Built With Stargazers License Telegram Channel


Logo

Python Codeforces API

A Codeforces API wrapper for Python.
Report Bug · Request Feature

About The Project

cforces is a complete implementation of the Codeforces-API, featuring classes for every type of the API, each with detailed documentation for a better understanding.

It's heavily inspired on Pyrogram structure and documentation.

(back to top)

Installation

From PyPi (stable)

pip install cforces

From Github (latest)

pip install git+https://github.com/x93bd0/cforces/

(back to top)

Basic Usage

As an example, in the following code snippet we are obtaining the handles of the friends of the authenticated user and printing their user objects:

from cforces import Client, types
from typing import List
import asyncio


async def main() -> None:
    client: Client = Client()  # Instantiate a Client object.
    client.auth(
        YOUR_API_KEY, YOUR_API_SECRET
    )  # Authenticate yourself with your api_key + api_secret.

    async with client as api:
        friends_handles: List[str] = (
            await api.user_friends()
        )  # Fetch authenticated user's friends.
        friends_users: List[User] = await api.user_info(
            friends_handles
        )  # Fetch a user object for each of those.

        for user in friends_users:
            print(user)  # Print it.


if __name__ == "__main__":
    asyncio.run(main())

(back to top)

TODO List

  • Finish the documentation.
  • Implement helper methods for making the interaction easier.
  • Find every possible error and implement it. (partial impl)
  • Add tests.
  • Fix bug: When a ';' is returned in the error comments, it is treated as a whole new error.
  • Better cc2sc

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cforces-0.1.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cforces-0.1.1-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file cforces-0.1.1.tar.gz.

File metadata

  • Download URL: cforces-0.1.1.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for cforces-0.1.1.tar.gz
Algorithm Hash digest
SHA256 96b8c977cae195f0e4485ff24a6fc31a060d5730e05f7a786d21900939fd2f40
MD5 c1f0b42535f691d7336c57ba25da7ca2
BLAKE2b-256 863bf4da35fc45821a051f0e2b668dc57e7b41012a5f8e4f4d2585b30c55e18d

See more details on using hashes here.

File details

Details for the file cforces-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cforces-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for cforces-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 07cc98c6fcd3eead4e55dda04605b618d988783a4d9aff398fcabcacf7dcd0a1
MD5 71d8ffc2eccb2522d2d259f7d14acc6c
BLAKE2b-256 c2aca1a33e828a5a0798d1a687a32df56f3e2e44f77135d85cf8bf5155f49c7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page