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.
pip install cforces
pip install git+https://github.com/x93bd0/cforces/
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())
- 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.
Distributed under the MIT License. See LICENSE
for more information.