A Codeforces API wrapper
Project description
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.
Installation
From PyPi (stable)
pip install cforces
From Github (latest)
pip install git+https://github.com/x93bd0/cforces/
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())
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
- Fetch data from a running contest for tests.
License
Distributed under the MIT License. See LICENSE for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cforces-0.2.0.tar.gz.
File metadata
- Download URL: cforces-0.2.0.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c56f45dbd9ba9b2d373703aa113d64abfe67b5872af00defc5d16b4358c7291
|
|
| MD5 |
52380c0ff6c795d7d764536861147616
|
|
| BLAKE2b-256 |
7afabaf049105f18a8ef7ffb17f1f2deaf66ecd1d72b68ad7b748af04c50b631
|
File details
Details for the file cforces-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cforces-0.2.0-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41a4df6f56301427099a9aa22e35185b28c8f838937d3ab5fdbca25944949142
|
|
| MD5 |
1581e84e4bf7710c51518c4c0b4a7fdd
|
|
| BLAKE2b-256 |
5cc1833e228fc0ade7984a4dad045495b182aa64109292886c5ce4e2f3f11e10
|