Changelog
- Add support for asynchronous client with `Client(is_async=True)`, see [the docs](https://codingame.readthedocs.io/en/latest/user_guide/async.html).
- Add support for context managers:
py
synchronous
with Client() as client:
client.get_global_leaderboard()
asynchronous
async with Client(is_async=True) as client:
await client.get_global_leaderboard()
- Remove properties like ``CodinGamer.followers`` in favor of methods like `CodinGamer.get_followers` to better differentiate API calls and to make it compatible with async API calls. Here's a list of all of the changed ones:
- `Client.language_ids` -> `Client.get_language_ids`
- `Client.unseen_notifications` -> `Client.get_unseen_notifications`
- `CodinGamer.followers` -> `CodinGamer.get_followers`
- `CodinGamer.followers_ids` -> `CodinGamer.get_followers_ids`
- `CodinGamer.following` -> `CodinGamer.get_followed`
- `CodinGamer.following_ids` -> `CodinGamer.get_followed_ids`
- `CodinGamer.clash_of_code_rank` ->
`CodinGamer.get_clash_of_code_rank`
- Add more exceptions: `LoginError` regroups all the exceptions related to login: `LoginRequired`, `EmailRequired`, `MalformedEmail`, `PasswordRequired`, `EmailNotLinked` and `IncorrectPassword`. And `NotFound` regroups `CodinGamerNotFound`, `ClashOfCodeNotFound`, `ChallengeNotFound` and `PuzzleNotFound`.
- Make all attributes of CodinGame models read-only.
- Add `ChallengeLeaderboard.has_leagues` and `PuzzleLeaderboard.has_leagues`.
- Add `Notification._raw`.
- Change `ClashOfCode.time_before_start` and `ClashOfCode.time_before_end` from `float` to `datetime.timedelta`.
- Remove argument type validation, not my fault if you can't read the docs.
- Rewrite the way the client works to implement a class to manage the connection state and separate the `Client` that the user uses from the HTTP client that interacts with the API.
Update
Update the module by doing `pip install codingame --upgrade`
Links
PyPi: https://pypi.org/project/codingame
Docs: https://codingame.readthedocs.io