codingame 1.5.0 API Reference#

The following section outlines the API of the codingame module. All the public classes, methods and functions are documented here.

Client#

Hybrid client#

class codingame.Client(is_async=False)[source]#

Client for the CodinGame API.

Instanciates a SyncClient if is_async is False or not given. Instanciates a AsyncClient if is_async is True.

Note

There are docs for both SyncClient and AsyncClient.

Parameters:

is_async (bool) – Whether the client is asynchronous. Defaults to False.

close()#

This function can be a coroutine.

Closes the client session.

property codingamer#

The CodinGamer that is logged in. None if the client isn’t logged in.

Type:

Optional CodinGamer

abstract create_private_clash_of_code(language_ids=[], modes=[])#

This function can be a coroutine.

Create a private Clash of Code with specified programming languages and modes.

You need to be logged in to create a Clash of Code or else a LoginRequired will be raised.

Note

If an invalid language is given, the API will ignores that language instead of raising an error. This function acts the same way.

Parameters:
  • language_ids (list of str) – The programming languages allowed in the Clash of Code. Get the list of options with get_language_ids(). Default: All languages allowed.

  • modes (list of str) – The modes from which the Clash of Code mode is chosen from. The valid modes are SHORTEST, FASTEST and REVERSE. Default: All modes allowed.

Raises:
Returns:

  • ClashOfCode

    The created Clash Of Code.

  • .. versionadded:: 1.5

abstract get_challenge_leaderboard(challenge_id, group='global')#

This function can be a coroutine.

Get the leaderboard of a challenge.

You can specify an optional group of users to rank.

Parameters:
  • challenge_id (str) – The string that identifies the challenge.

  • group (Optional str) – The group of users to rank. For every group except "global", you need to be logged in. One of "global", "country", "company", "school" or "following". Default: "global".

Raises:
  • ValueError – One of the arguments isn’t one of the accepted arguments.

  • LoginRequired – The client isn’t logged in and the group is one of "country", "company", "school" or "following".

  • ChallengeNotFound – There is no challenge with the given challenge_id.

Returns:

abstract get_clash_of_code(handle)#

This function can be a coroutine.

Get a Clash of Code from its public handle.

Parameters:

handle (str) – The Clash of Code’s public handle. 39 character long hexadecimal string (regex: [0-9]{7}[0-9a-f]{32}).

Raises:
  • ValueError – The Clash of Code handle isn’t in the good format.

  • ClashOfCodeNotFound – The Clash of Code with the given public handle isn’t found.

Returns:

  • ClashOfCode

    The requested Clash Of Code.

  • .. versionadded:: 0.2

abstract get_codingamer(codingamer)#

This function can be a coroutine.

Get a CodinGamer from their public handle, their ID or from their pseudo.

Note

codingamer can be the public handle, the ID or the pseudo. Using the public handle or the ID is reccomended because it won’t change even if the codingamer changes their pseudo.

The public handle is a 39 character long hexadecimal string that is unique to the CodinGamer and identifies them. Regex of a public handle: [0-9a-f]{32}[0-9]{7}

The ID is a 7 number long integer.

Parameters:

codingamer (str or int) – The CodinGamer’s public handle, ID or pseudo.

Raises:

CodinGamerNotFound – The CodinGamer with the given public handle, ID or pseudo isn’t found.

Returns:

  • CodinGamer

    The requested CodinGamer.

  • .. versionadded:: 0.1

  • .. versionchanged:: 0.2 – Renamed Client.codingamer() to get_codingamer().

  • .. versionchanged:: 0.3.3 – Add searching with CodinGamer pseudo.

  • .. versionchanged:: 0.3.5 – Add searching with CodinGamer ID.

abstract get_global_leaderboard(page=1, type='GENERAL', group='global')#

This function can be a coroutine.

Get the global leaderboard of CodinGame.

You can specify an optional page, type of leaderboard and the group of users to rank.

Parameters:
  • page (Optional int) – The page of the leaderboard to get the users from. Default: 1.

  • type (Optional str) – The type of global leaderboard to show. One of "GENERAL", "CONTESTS", "BOT_PROGRAMMING", "OPTIM" or "CODEGOLF". Default: "GENERAL".

  • group (Optional str) – The group of users to rank. For every group except "global", you need to be logged in. One of "global", "country", "company", "school" or "following". Default: "global".

Raises:
  • ValueError – One of the arguments isn’t one of the accepted arguments.

  • LoginRequired – The client isn’t logged in and the group is one of "country", "company", "school" or "following".

Returns:

abstract get_language_ids()#

This function can be a coroutine.

Get the list of all available language IDs.

Returns:

  • list of str

    The language IDs.

  • .. versionadded:: 0.3

  • .. versionchanged:: 1.0 – Renamed Client.language_ids to get_language_ids().

abstract get_pending_clash_of_code()#

This function can be a coroutine.

Get the pending public Clash of Code.

Returns:

  • Optional ClashOfCode

    The pending Clash Of Code if there’s one, or None if there’s no current public Clash Of Code.

  • .. versionadded:: 0.3.2

abstract get_puzzle_leaderboard(puzzle_id, group='global')#

This function can be a coroutine.

Get the leaderboard of a puzzle.

You can specify an optional group of users to rank.

Parameters:
  • puzzle_id (str) – The string that identifies the puzzle.

  • group (Optional str) – The group of users to rank. For every group except "global", you need to be logged in. One of "global", "country", "company", "school" or "following". Default: "global".

Raises:
  • ValueError – One of the arguments isn’t one of the accepted arguments.

  • LoginRequired – The client isn’t logged in and the group is one of "country", "company", "school" or "following".

  • PuzzleNotFound – There is no puzzle with the given puzzle_id.

Returns:

abstract get_read_notifications()#

This function can be a coroutine.

Get the read notifications of the logged in CodinGamer.

You need to be logged in to get notifications or else a LoginRequired will be raised.

Warning

There can be some old notifications missing.

Note

This method is a generator.

Raises:

LoginRequired – The Client needs to log in. See login().

Yields:

Notification – A read notification.

New in version 1.3.

abstract get_unread_notifications()#

This function can be a coroutine.

Get all the unread notifications of the logged in CodinGamer.

This includes unseen notifications along with the unread ones.

You need to be logged in to get notifications or else a LoginRequired will be raised.

Note

This method is a generator.

Raises:

LoginRequired – The Client needs to log in. See login().

Yields:

Notification – An unread notification.

New in version 1.3.

abstract get_unseen_notifications()#

This function can be a coroutine.

Get all the unseen notifications of the logged in CodinGamer.

You need to be logged in to get notifications or else a LoginRequired will be raised.

Note

This method is a generator.

Raises:

LoginRequired – The Client needs to log in. See login().

Yields:

Notification – An unseen notification.

New in version 0.3.1.

Changed in version 1.0: Renamed Client.notifications to get_unseen_notifications().

property is_async#

Whether the client is asynchronous.

Type:

bool

abstract join_private_clash_of_code(handle)#

This function can be a coroutine.

Join the private Clash of Code with the specified handle.

You need to be logged in to join a Clash of Code or else a LoginRequired will be raised.

Parameters:

handle (ClashOfCode or str) – The Clash of Code to join or its public handle.

Raises:
Returns:

  • ClashOfCode

    The joined Clash Of Code.

  • .. versionadded:: 1.5

property logged_in#

Whether the client is logged in.

Type:

bool

abstract login(email=None, password=None, remember_me_cookie=None)#

This function can be a coroutine.

Login to a CodinGame account.

Error

As of 2021-10-27, the only way to login is with cookie authentication, so with the remember_me_cookie parameter, because of an endpoint change, see Login. Using email/password authentication will raise a LoginError.

Parameters:
  • email (Optional str) – Email adress of the CodinGamer. Not needed if using session ID login.

  • password (Optional str) – Password of the CodinGamer. Not needed if using cookie login.

  • remember_me_cookie (Optional str) – rememberMe cookie from CodinGame cookies. Not needed if using email/password login.

Raises:

LoginError – Error with the login (empty email, empty password, wrong email format, incorrect password, etc).

Returns:

  • CodinGamer

    The CodinGamer that logged in.

  • .. versionadded:: 0.3

abstract mark_notifications_as_read(notifications)#

This function can be a coroutine.

Mark notifications of the logged in CodinGamer as read.

You need to be logged in to mark notifications as read or else a LoginRequired will be raised.

Parameters:

notifications (list of Notification or int) – The notifications to mark as read. Can be either the notification or its ID.

Raises:
Returns:

  • datetime

    The time when this notification was marked as read.

  • .. versionadded:: 1.4

abstract mark_notifications_as_seen(notifications)#

This function can be a coroutine.

Mark notifications of the logged in CodinGamer as seen.

You need to be logged in to mark notifications as seen or else a LoginRequired will be raised.

Parameters:

notifications (list of Notification or int) – The notifications to mark as seen. Can be either the notification or its ID.

Raises:
Returns:

  • datetime

    The time when this notification was marked as seen.

  • .. versionadded:: 1.4

request(service, func, parameters=[])#

This function can be a coroutine.

Make a request to the CodinGame API service.

This is useful if you want to use some services that aren’t implemented yet in this library, but you want to use the authentication that this library provides.

Note

The CodinGame API URLs are in the format https://www.codingame.com/services/{service}/{func}.

Parameters:
  • service (str) – The CodinGame API service.

  • func (str) – The CodinGame API function.

  • parameters (Optional list) – The parameters to the API. Default: []

Raises:
  • ValueErrorservice or function parameter is empty.

  • HTTPError – Error with the API (service or function not found, wrong number of parameters, bad parameters, etc).

Returns:

  • Anything

    The data returned by the CodinGame API, usually a dict.

  • .. versionadded:: 1.2

Synchronous client#

class codingame.client.sync.SyncClient[source]#

Synchronous client for the CodinGame client.

login(email=None, password=None, remember_me_cookie=None)[source]#

Login to a CodinGame account.

Error

As of 2021-10-27, the only way to login is with cookie authentication, so with the remember_me_cookie parameter, because of an endpoint change, see Login. Using email/password authentication will raise a LoginError.

Parameters:
  • email (Optional str) – Email adress of the CodinGamer. Not needed if using session ID login.

  • password (Optional str) – Password of the CodinGamer. Not needed if using cookie login.

  • remember_me_cookie (Optional str) – rememberMe cookie from CodinGame cookies. Not needed if using email/password login.

Raises:

LoginError – Error with the login (empty email, empty password, wrong email format, incorrect password, etc).

Returns:

  • CodinGamer

    The CodinGamer that logged in.

  • .. versionadded:: 0.3

get_codingamer(codingamer)[source]#

Get a CodinGamer from their public handle, their ID or from their pseudo.

Note

codingamer can be the public handle, the ID or the pseudo. Using the public handle or the ID is reccomended because it won’t change even if the codingamer changes their pseudo.

The public handle is a 39 character long hexadecimal string that is unique to the CodinGamer and identifies them. Regex of a public handle: [0-9a-f]{32}[0-9]{7}

The ID is a 7 number long integer.

Parameters:

codingamer (str or int) – The CodinGamer’s public handle, ID or pseudo.

Raises:

CodinGamerNotFound – The CodinGamer with the given public handle, ID or pseudo isn’t found.

Returns:

  • CodinGamer

    The requested CodinGamer.

  • .. versionadded:: 0.1

  • .. versionchanged:: 0.2 – Renamed Client.codingamer() to get_codingamer().

  • .. versionchanged:: 0.3.3 – Add searching with CodinGamer pseudo.

  • .. versionchanged:: 0.3.5 – Add searching with CodinGamer ID.

get_clash_of_code(handle)[source]#

Get a Clash of Code from its public handle.

Parameters:

handle (str) – The Clash of Code’s public handle. 39 character long hexadecimal string (regex: [0-9]{7}[0-9a-f]{32}).

Raises:
  • ValueError – The Clash of Code handle isn’t in the good format.

  • ClashOfCodeNotFound – The Clash of Code with the given public handle isn’t found.

Returns:

  • ClashOfCode

    The requested Clash Of Code.

  • .. versionadded:: 0.2

get_pending_clash_of_code()[source]#

Get the pending public Clash of Code.

Returns:

  • Optional ClashOfCode

    The pending Clash Of Code if there’s one, or None if there’s no current public Clash Of Code.

  • .. versionadded:: 0.3.2

create_private_clash_of_code(language_ids=[], modes=[])[source]#

Create a private Clash of Code with specified programming languages and modes.

You need to be logged in to create a Clash of Code or else a LoginRequired will be raised.

Note

If an invalid language is given, the API will ignores that language instead of raising an error. This function acts the same way.

Parameters:
  • language_ids (list of str) – The programming languages allowed in the Clash of Code. Get the list of options with get_language_ids(). Default: All languages allowed.

  • modes (list of str) – The modes from which the Clash of Code mode is chosen from. The valid modes are SHORTEST, FASTEST and REVERSE. Default: All modes allowed.

Raises:
Returns:

  • ClashOfCode

    The created Clash Of Code.

  • .. versionadded:: 1.5

join_private_clash_of_code(clash_of_code)[source]#

Join the private Clash of Code with the specified handle.

You need to be logged in to join a Clash of Code or else a LoginRequired will be raised.

Parameters:

handle (ClashOfCode or str) – The Clash of Code to join or its public handle.

Raises:
Returns:

  • ClashOfCode

    The joined Clash Of Code.

  • .. versionadded:: 1.5

get_language_ids()[source]#

Get the list of all available language IDs.

Returns:

  • list of str

    The language IDs.

  • .. versionadded:: 0.3

  • .. versionchanged:: 1.0 – Renamed Client.language_ids to get_language_ids().

get_unseen_notifications()[source]#

Get all the unseen notifications of the logged in CodinGamer.

You need to be logged in to get notifications or else a LoginRequired will be raised.

Note

This method is a generator.

Raises:

LoginRequired – The Client needs to log in. See login().

Yields:

Notification – An unseen notification.

New in version 0.3.1.

Changed in version 1.0: Renamed Client.notifications to get_unseen_notifications().

get_unread_notifications()[source]#

Get all the unread notifications of the logged in CodinGamer.

This includes unseen notifications along with the unread ones.

You need to be logged in to get notifications or else a LoginRequired will be raised.

Note

This method is a generator.

Raises:

LoginRequired – The Client needs to log in. See login().

Yields:

Notification – An unread notification.

New in version 1.3.

get_read_notifications()[source]#

Get the read notifications of the logged in CodinGamer.

You need to be logged in to get notifications or else a LoginRequired will be raised.

Warning

There can be some old notifications missing.

Note

This method is a generator.

Raises:

LoginRequired – The Client needs to log in. See login().

Yields:

Notification – A read notification.

New in version 1.3.

mark_notifications_as_seen(notifications)[source]#

Mark notifications of the logged in CodinGamer as seen.

You need to be logged in to mark notifications as seen or else a LoginRequired will be raised.

Parameters:

notifications (list of Notification or int) – The notifications to mark as seen. Can be either the notification or its ID.

Raises:
Returns:

  • datetime

    The time when this notification was marked as seen.

  • .. versionadded:: 1.4

mark_notifications_as_read(notifications)[source]#

Mark notifications of the logged in CodinGamer as read.

You need to be logged in to mark notifications as read or else a LoginRequired will be raised.

Parameters:

notifications (list of Notification or int) – The notifications to mark as read. Can be either the notification or its ID.

Raises:
Returns:

  • datetime

    The time when this notification was marked as read.

  • .. versionadded:: 1.4

get_global_leaderboard(page=1, type='GENERAL', group='global')[source]#

Get the global leaderboard of CodinGame.

You can specify an optional page, type of leaderboard and the group of users to rank.

Parameters:
  • page (Optional int) – The page of the leaderboard to get the users from. Default: 1.

  • type (Optional str) – The type of global leaderboard to show. One of "GENERAL", "CONTESTS", "BOT_PROGRAMMING", "OPTIM" or "CODEGOLF". Default: "GENERAL".

  • group (Optional str) – The group of users to rank. For every group except "global", you need to be logged in. One of "global", "country", "company", "school" or "following". Default: "global".

Raises:
  • ValueError – One of the arguments isn’t one of the accepted arguments.

  • LoginRequired – The client isn’t logged in and the group is one of "country", "company", "school" or "following".

Returns:

get_challenge_leaderboard(challenge_id, group='global')[source]#

Get the leaderboard of a challenge.

You can specify an optional group of users to rank.

Parameters:
  • challenge_id (str) – The string that identifies the challenge.

  • group (Optional str) – The group of users to rank. For every group except "global", you need to be logged in. One of "global", "country", "company", "school" or "following". Default: "global".

Raises:
  • ValueError – One of the arguments isn’t one of the accepted arguments.

  • LoginRequired – The client isn’t logged in and the group is one of "country", "company", "school" or "following".

  • ChallengeNotFound – There is no challenge with the given challenge_id.

Returns:

get_puzzle_leaderboard(puzzle_id, group='global')[source]#

Get the leaderboard of a puzzle.

You can specify an optional group of users to rank.

Parameters:
  • puzzle_id (str) – The string that identifies the puzzle.

  • group (Optional str) – The group of users to rank. For every group except "global", you need to be logged in. One of "global", "country", "company", "school" or "following". Default: "global".

Raises:
  • ValueError – One of the arguments isn’t one of the accepted arguments.

  • LoginRequired – The client isn’t logged in and the group is one of "country", "company", "school" or "following".

  • PuzzleNotFound – There is no puzzle with the given puzzle_id.

Returns:

close()#

This function can be a coroutine.

Closes the client session.

property codingamer#

The CodinGamer that is logged in. None if the client isn’t logged in.

Type:

Optional CodinGamer

property is_async#

Whether the client is asynchronous.

Type:

bool

property logged_in#

Whether the client is logged in.

Type:

bool

request(service, func, parameters=[])#

This function can be a coroutine.

Make a request to the CodinGame API service.

This is useful if you want to use some services that aren’t implemented yet in this library, but you want to use the authentication that this library provides.

Note

The CodinGame API URLs are in the format https://www.codingame.com/services/{service}/{func}.

Parameters:
  • service (str) – The CodinGame API service.

  • func (str) – The CodinGame API function.

  • parameters (Optional list) – The parameters to the API. Default: []

Raises:
  • ValueErrorservice or function parameter is empty.

  • HTTPError – Error with the API (service or function not found, wrong number of parameters, bad parameters, etc).

Returns:

  • Anything

    The data returned by the CodinGame API, usually a dict.

  • .. versionadded:: 1.2

Asynchronous client#

class codingame.client.async_.AsyncClient[source]#

Asynchronous client for the CodinGame API.

async close()[source]#

This function is a coroutine.

Closes the client session.

async login(email=None, password=None, remember_me_cookie=None)[source]#

This function is a coroutine.

Login to a CodinGame account.

Error

As of 2021-10-27, the only way to login is with cookie authentication, so with the remember_me_cookie parameter, because of an endpoint change, see Login. Using email/password authentication will raise a LoginError.

Parameters:
  • email (Optional str) – Email adress of the CodinGamer. Not needed if using session ID login.

  • password (Optional str) – Password of the CodinGamer. Not needed if using cookie login.

  • remember_me_cookie (Optional str) – rememberMe cookie from CodinGame cookies. Not needed if using email/password login.

Raises:

LoginError – Error with the login (empty email, empty password, wrong email format, incorrect password, etc).

Returns:

  • CodinGamer

    The CodinGamer that logged in.

  • .. versionadded:: 0.3

async get_codingamer(codingamer)[source]#

This function is a coroutine.

Get a CodinGamer from their public handle, their ID or from their pseudo.

Note

codingamer can be the public handle, the ID or the pseudo. Using the public handle or the ID is reccomended because it won’t change even if the codingamer changes their pseudo.

The public handle is a 39 character long hexadecimal string that is unique to the CodinGamer and identifies them. Regex of a public handle: [0-9a-f]{32}[0-9]{7}

The ID is a 7 number long integer.

Parameters:

codingamer (str or int) – The CodinGamer’s public handle, ID or pseudo.

Raises:

CodinGamerNotFound – The CodinGamer with the given public handle, ID or pseudo isn’t found.

Returns:

  • CodinGamer

    The requested CodinGamer.

  • .. versionadded:: 0.1

  • .. versionchanged:: 0.2 – Renamed Client.codingamer() to get_codingamer().

  • .. versionchanged:: 0.3.3 – Add searching with CodinGamer pseudo.

  • .. versionchanged:: 0.3.5 – Add searching with CodinGamer ID.

async get_clash_of_code(handle)[source]#

This function is a coroutine.

Get a Clash of Code from its public handle.

Parameters:

handle (str) – The Clash of Code’s public handle. 39 character long hexadecimal string (regex: [0-9]{7}[0-9a-f]{32}).

Raises:
  • ValueError – The Clash of Code handle isn’t in the good format.

  • ClashOfCodeNotFound – The Clash of Code with the given public handle isn’t found.

Returns:

  • ClashOfCode

    The requested Clash Of Code.

  • .. versionadded:: 0.2

async get_pending_clash_of_code()[source]#

This function is a coroutine.

Get the pending public Clash of Code.

Returns:

  • Optional ClashOfCode

    The pending Clash Of Code if there’s one, or None if there’s no current public Clash Of Code.

  • .. versionadded:: 0.3.2

async create_private_clash_of_code(language_ids=[], modes=[])[source]#

This function is a coroutine.

Create a private Clash of Code with specified programming languages and modes.

You need to be logged in to create a Clash of Code or else a LoginRequired will be raised.

Note

If an invalid language is given, the API will ignores that language instead of raising an error. This function acts the same way.

Parameters:
  • language_ids (list of str) – The programming languages allowed in the Clash of Code. Get the list of options with get_language_ids(). Default: All languages allowed.

  • modes (list of str) – The modes from which the Clash of Code mode is chosen from. The valid modes are SHORTEST, FASTEST and REVERSE. Default: All modes allowed.

Raises:
Returns:

  • ClashOfCode

    The created Clash Of Code.

  • .. versionadded:: 1.5

async join_private_clash_of_code(clash_of_code)[source]#

This function is a coroutine.

Join the private Clash of Code with the specified handle.

You need to be logged in to join a Clash of Code or else a LoginRequired will be raised.

Parameters:

handle (ClashOfCode or str) – The Clash of Code to join or its public handle.

Raises:
Returns:

  • ClashOfCode

    The joined Clash Of Code.

  • .. versionadded:: 1.5

async get_language_ids()[source]#

This function is a coroutine.

Get the list of all available language IDs.

Returns:

  • list of str

    The language IDs.

  • .. versionadded:: 0.3

  • .. versionchanged:: 1.0 – Renamed Client.language_ids to get_language_ids().

async get_unseen_notifications()[source]#

This function is a coroutine.

Get all the unseen notifications of the logged in CodinGamer.

You need to be logged in to get notifications or else a LoginRequired will be raised.

Note

This method is a generator.

Raises:

LoginRequired – The Client needs to log in. See login().

Yields:

Notification – An unseen notification.

New in version 0.3.1.

Changed in version 1.0: Renamed Client.notifications to get_unseen_notifications().

async get_unread_notifications()[source]#

This function is a coroutine.

Get all the unread notifications of the logged in CodinGamer.

This includes unseen notifications along with the unread ones.

You need to be logged in to get notifications or else a LoginRequired will be raised.

Note

This method is a generator.

Raises:

LoginRequired – The Client needs to log in. See login().

Yields:

Notification – An unread notification.

New in version 1.3.

async get_read_notifications()[source]#

This function is a coroutine.

Get the read notifications of the logged in CodinGamer.

You need to be logged in to get notifications or else a LoginRequired will be raised.

Warning

There can be some old notifications missing.

Note

This method is a generator.

Raises:

LoginRequired – The Client needs to log in. See login().

Yields:

Notification – A read notification.

New in version 1.3.

async mark_notifications_as_seen(notifications)[source]#

This function is a coroutine.

Mark notifications of the logged in CodinGamer as seen.

You need to be logged in to mark notifications as seen or else a LoginRequired will be raised.

Parameters:

notifications (list of Notification or int) – The notifications to mark as seen. Can be either the notification or its ID.

Raises:
Returns:

  • datetime

    The time when this notification was marked as seen.

  • .. versionadded:: 1.4

async mark_notifications_as_read(notifications)[source]#

This function is a coroutine.

Mark notifications of the logged in CodinGamer as read.

You need to be logged in to mark notifications as read or else a LoginRequired will be raised.

Parameters:

notifications (list of Notification or int) – The notifications to mark as read. Can be either the notification or its ID.

Raises:
Returns:

  • datetime

    The time when this notification was marked as read.

  • .. versionadded:: 1.4

async get_global_leaderboard(page=1, type='GENERAL', group='global')[source]#

This function is a coroutine.

Get the global leaderboard of CodinGame.

You can specify an optional page, type of leaderboard and the group of users to rank.

Parameters:
  • page (Optional int) – The page of the leaderboard to get the users from. Default: 1.

  • type (Optional str) – The type of global leaderboard to show. One of "GENERAL", "CONTESTS", "BOT_PROGRAMMING", "OPTIM" or "CODEGOLF". Default: "GENERAL".

  • group (Optional str) – The group of users to rank. For every group except "global", you need to be logged in. One of "global", "country", "company", "school" or "following". Default: "global".

Raises:
  • ValueError – One of the arguments isn’t one of the accepted arguments.

  • LoginRequired – The client isn’t logged in and the group is one of "country", "company", "school" or "following".

Returns:

async get_challenge_leaderboard(challenge_id, group='global')[source]#

This function is a coroutine.

Get the leaderboard of a challenge.

You can specify an optional group of users to rank.

Parameters:
  • challenge_id (str) – The string that identifies the challenge.

  • group (Optional str) – The group of users to rank. For every group except "global", you need to be logged in. One of "global", "country", "company", "school" or "following". Default: "global".

Raises:
  • ValueError – One of the arguments isn’t one of the accepted arguments.

  • LoginRequired – The client isn’t logged in and the group is one of "country", "company", "school" or "following".

  • ChallengeNotFound – There is no challenge with the given challenge_id.

Returns:

async get_puzzle_leaderboard(puzzle_id, group='global')[source]#

This function is a coroutine.

Get the leaderboard of a puzzle.

You can specify an optional group of users to rank.

Parameters:
  • puzzle_id (str) – The string that identifies the puzzle.

  • group (Optional str) – The group of users to rank. For every group except "global", you need to be logged in. One of "global", "country", "company", "school" or "following". Default: "global".

Raises:
  • ValueError – One of the arguments isn’t one of the accepted arguments.

  • LoginRequired – The client isn’t logged in and the group is one of "country", "company", "school" or "following".

  • PuzzleNotFound – There is no puzzle with the given puzzle_id.

Returns:

property codingamer#

The CodinGamer that is logged in. None if the client isn’t logged in.

Type:

Optional CodinGamer

property is_async#

Whether the client is asynchronous.

Type:

bool

property logged_in#

Whether the client is logged in.

Type:

bool

request(service, func, parameters=[])#

This function can be a coroutine.

Make a request to the CodinGame API service.

This is useful if you want to use some services that aren’t implemented yet in this library, but you want to use the authentication that this library provides.

Note

The CodinGame API URLs are in the format https://www.codingame.com/services/{service}/{func}.

Parameters:
  • service (str) – The CodinGame API service.

  • func (str) – The CodinGame API function.

  • parameters (Optional list) – The parameters to the API. Default: []

Raises:
  • ValueErrorservice or function parameter is empty.

  • HTTPError – Error with the API (service or function not found, wrong number of parameters, bad parameters, etc).

Returns:

  • Anything

    The data returned by the CodinGame API, usually a dict.

  • .. versionadded:: 1.2

CodinGame Models#

Models are classes that are created from the data received from CodinGame and are not meant to be created by the user of the library.

Danger

The classes listed below are not intended to be created by users and are also read-only.

For example, this means that you should not make your own CodinGamer instances nor should you modify the CodinGamer instance yourself.

CodinGamer#

class codingame.PartialCodinGamer(state, data)[source]#

Represents a partial CodinGamer.

This class doesn’t have all the data of a CodinGamer. Use client.get_codingamer(partial_codingamer.public_handle) for that.

public_handle#

Public handle of the CodinGamer (hexadecimal str).

Type:

str

id#

ID of the CodinGamer. Last 7 digits of the public_handle reversed.

Type:

int

pseudo#

Pseudo of the CodinGamer.

Type:

Optional str

country_id#

Country ID of the CodinGamer.

Type:

str

avatar#

Avatar ID of the CodinGamer. You can get the avatar url with avatar_url.

Type:

Optional int

cover#

Cover ID of the CodinGamer. You can get the cover url with cover_url.

Type:

Optional int

property avatar_url#

Avatar URL of the CodinGamer.

Type:

Optional str

property cover_url#

Cover URL of the CodinGamer.

Type:

Optional str

public_handle#

Type:    str

id#

Type:    int

pseudo#

Type:    Optional[str]

avatar#

Type:    Optional[int]

cover#

Type:    Optional[int]

property profile_url#

The URL of the CodinGamer profile.

Type:

str

get_followers()[source]#

This function can be a coroutine.

Get all the followers of a CodinGamer.

You need to be logged in to get the followers or else a LoginRequired will be raised. If you can’t log in, you can use CodinGamer.get_followers_ids() instead.

Note

This property is a generator.

Warning

The xp attribute of the following codingamers is None.

Raises:

LoginRequired – The Client needs to log in. See Client.login().

Yields:

CodinGamer – The follower.

get_followers_ids()[source]#

This function can be a coroutine.

Get all the IDs of the followers of a CodinGamer.

Returns:

list of int

The CodinGamer’s followers IDs. See CodinGamer.id.

get_followed()[source]#

This function can be a coroutine.

Get all the followed CodinGamers.

You need to be logged in to get the followed CodinGamers or else a LoginRequired will be raised. If you can’t log in, you can use CodinGamer.get_followed_ids() instead.

Note

This property is a generator.

Warning

The xp attribute of the followed codingamers is None.

Raises:

LoginRequired – The Client needs to log in. See Client.login().

Yields:

CodinGamer – The followed CodinGamer.

get_followed_ids()[source]#

This function can be a coroutine.

Get all the IDs of the followed CodinGamers.

Returns:

list of int

The IDs of the followed CodinGamers. See CodinGamer.id.

get_clash_of_code_rank()[source]#

This function can be a coroutine.

Get the Clash of Code rank of the CodinGamer.

Returns:

int

The Clash of Code rank of the CodinGamer.

class codingame.CodinGamer(state, data)[source]#

Represents a CodinGamer.

public_handle#

Public handle of the CodinGamer (hexadecimal str).

Type:

str

id#

ID of the CodinGamer. Last 7 digits of the public_handle reversed.

Type:

int

pseudo#

Pseudo of the CodinGamer.

Type:

Optional str

rank#

Worldwide rank of the CodinGamer.

Type:

int

level#

Level of the CodinGamer.

Type:

int

xp#

XP points of the CodinGamer.

Type:

int

country_id#

Country ID of the CodinGamer.

Type:

str

category#

Category of the CodinGamer. Can be STUDENT or PROFESSIONAL.

Note

You can use student and professional to get a bool that describes the CodinGamer’s category.

Type:

Optional str

student#

Whether the CodinGamer is a student.

Type:

bool

professional#

Whether the CodinGamer is a professional.

Type:

bool

tagline#

Tagline of the CodinGamer.

Type:

Optional str

biography#

Biography of the CodinGamer.

Type:

Optional str

company#

Company of the CodinGamer.

Type:

Optional str

school#

School of the CodinGamer.

Type:

Optional str

avatar#

Avatar ID of the CodinGamer. You can get the avatar url with avatar_url.

Type:

Optional int

cover#

Cover ID of the CodinGamer. You can get the cover url with cover_url.

Type:

Optional int

public_handle#

Type:    str

id#

Type:    int

pseudo#

Type:    Optional[str]

avatar#

Type:    Optional[int]

get_clash_of_code_rank()#

This function can be a coroutine.

Get the Clash of Code rank of the CodinGamer.

Returns:

int

The Clash of Code rank of the CodinGamer.

get_followed()#

This function can be a coroutine.

Get all the followed CodinGamers.

You need to be logged in to get the followed CodinGamers or else a LoginRequired will be raised. If you can’t log in, you can use CodinGamer.get_followed_ids() instead.

Note

This property is a generator.

Warning

The xp attribute of the followed codingamers is None.

Raises:

LoginRequired – The Client needs to log in. See Client.login().

Yields:

CodinGamer – The followed CodinGamer.

get_followed_ids()#

This function can be a coroutine.

Get all the IDs of the followed CodinGamers.

Returns:

list of int

The IDs of the followed CodinGamers. See CodinGamer.id.

get_followers()#

This function can be a coroutine.

Get all the followers of a CodinGamer.

You need to be logged in to get the followers or else a LoginRequired will be raised. If you can’t log in, you can use CodinGamer.get_followers_ids() instead.

Note

This property is a generator.

Warning

The xp attribute of the following codingamers is None.

Raises:

LoginRequired – The Client needs to log in. See Client.login().

Yields:

CodinGamer – The follower.

get_followers_ids()#

This function can be a coroutine.

Get all the IDs of the followers of a CodinGamer.

Returns:

list of int

The CodinGamer’s followers IDs. See CodinGamer.id.

property profile_url#

The URL of the CodinGamer profile.

Type:

str

cover#

Type:    Optional[int]

property avatar_url#

Avatar URL of the CodinGamer.

Type:

Optional str

property cover_url#

Cover URL of the CodinGamer.

Type:

Optional str

Clash of Code#

class codingame.ClashOfCode(state, data)[source]#

Represents a Clash of Code.

public_handle#

Public handle of the Clash of Code (hexadecimal str).

Type:

str

join_url#

URL to join the Clash of Code.

Type:

str

public#

Whether the Clash of Code is public.

Type:

bool

min_players#

Minimum number of players.

Type:

int

max_players#

Maximum number of players.

Type:

int

modes#

List of possible modes.

Type:

Optional list of str

programming_languages#

List of possible programming languages.

Type:

Optional list of str

started#

Whether the Clash of Code is started.

Type:

bool

finished#

Whether the Clash of Code is finished.

Type:

bool

mode#

The mode of the Clash of Code.

Type:

Optional str

creation_time#

Creation time of the Clash of Code. Doesn’t always exist.

Type:

Optional datetime

start_time#

Start time of the Clash of Code. If the Clash of Code hasn’t started yet, this is the expected start time of the Clash of Code.

Type:

datetime

end_time#

End time of the Clash of Code.

Type:

Optional datetime

time_before_start#

Time before the start of the Clash of Code.

Type:

timedelta

time_before_end#

Time before the end of the Clash of Code.

Type:

Optional timedelta

players#

List of the players in the Clash of Code.

Type:

list of Player

fetch()[source]#

This function can be a coroutine.

Get and update the information about this Clash Of Code.

This modifies this object’s own attributes in place.

join(refetch=False)[source]#

This function can be a coroutine.

Join this Clash Of Code.

You need to be logged in to join a Clash of Code or else a LoginRequired will be raised.

Parameters:

refetch (bool) – Whether to update this object after joining. Default: False

Raises:

LoginRequired – The Client needs to log in. See Client.login().

start(refetch=False)[source]#

This function can be a coroutine.

Start this Clash Of Code.

You need to be logged in as the owner to start a Clash of Code or else a LoginRequired will be raised.

Note

This sets the countdown to the start to 5s. You will need to fetch the Clash Of Code again in 5-10s.

Parameters:

refetch (bool) – Whether to update this object after starting. Default: False

Raises:

LoginRequired – The Client needs to log in. See Client.login().

leave(refetch=False)[source]#

This function can be a coroutine.

Leave this Clash Of Code.

You need to be logged in or else a LoginRequired will be raised.

Parameters:

refetch (bool) – Whether to update this object after leaving. Default: False

Raises:

LoginRequired – The Client needs to log in. See Client.login().

get_question(refetch=False)[source]#

This function can be a coroutine.

Get the question for this Clash of Code.

You need to be logged in or else a LoginRequired will be raised.

Parameters:

refetch (bool) – Whether to update this object after getting the question. Default: False

Raises:

LoginRequired – The Client needs to log in. See Client.login().

play_test_cases(language_id, code, indexes=None, refetch=False)[source]#

This function can be a coroutine.

Play test cases for this Clash of Code with the given code.

You need to be logged in or else a LoginRequired will be raised.

Parameters:
  • language_id (str) – The language ID of the used programming language.

  • code (str) – The code to test against the test cases.

  • indexes (list of int) – The indexes of the test cases to test the code. Default: all test cases

  • refetch (bool) – Whether to update this object after getting the question. Default: False

Raises:

LoginRequired – The Client needs to log in. See Client.login().

submit(language_id, code, share=False, refetch=False)[source]#

This function can be a coroutine.

Submit your solution for this Clash of Code.

You need to be logged in or else a LoginRequired will be raised.

Parameters:
  • language_id (str) – The language ID of the used programming language.

  • code (str) – The code to test against the test cases.

  • share (bool) – Whether to share the solution. Default: False

  • refetch (bool) – Whether to update this object after getting the question. Default: False

Raises:

LoginRequired – The Client needs to log in. See Client.login().

class codingame.Player(state, clash_of_code, started, finished, data)[source]#

Represents a Clash of Code player.

clash_of_code#

Clash of Code the Player belongs to.

Type:

ClashOfCode

public_handle#

Public handle of the CodinGamer (hexadecimal str). Sometimes missing, prefer id.

Type:

str

id#

ID of the CodinGamer. Last 7 digits of the public_handle reversed.

Type:

int

pseudo#

Pseudo of the CodinGamer.

Type:

int

avatar#

Avatar ID of the CodinGamer. You can get the avatar url with avatar_url.

Type:

Optional int

cover#

Cover ID of the CodinGamer. In this case, always None.

Type:

Optional int

started#

Whether the Clash of Code is started.

Type:

bool

finished#

Whether the Clash of Code is finished.

Type:

bool

status#

Status of the Player. Can be OWNER or STANDARD.

Note

You can use owner to get a bool that describes whether the player is the owner.

Type:

str

owner#

Whether the player is the Clash of Code owner.

Type:

bool

position#

Join position of the Player.

Type:

Optional int

rank#

Rank of the Player. Only use this when the Clash of Code is finished because it isn’t precise until then.

Type:

Optional int

duration#

Time taken by the player to solve the problem of the Clash of Code.

Type:

Optional timedelta

language_id#

Language ID of the language the player used in the Clash of Code.

Type:

Optional str

score#

Score of the Player (between 0 and 100).

Type:

Optional int

code_length#

Length of the Player’s code. Only available when the Clash of Code’s mode is SHORTEST.

Type:

Optional int

solution_shared#

Whether the Player shared their code.

Type:

Optional bool

solution_id#

ID of the player’s submission.

Type:

Optional int

public_handle#

Type:    str

id#

Type:    int

pseudo#

Type:    Optional[str]

avatar#

Type:    Optional[int]

property avatar_url#

Avatar URL of the CodinGamer.

Type:

Optional str

cover#

Type:    Optional[int]

property cover_url#

Cover URL of the CodinGamer.

Type:

Optional str

class codingame.Question(state, clash_of_code, data)[source]#
class codingame.ClashOfCodeContribution(state, contributor, data)[source]#
class codingame.TestCase(state, data)[source]#
class codingame.TestCaseResult(state, clash_of_code, test_case, data)[source]#

Represents the result of a test case run.

clash_of_code#

The clash of code that is played.

Type:

ClashOfCode

test_case#

The test case that has been played.

Type:

TestCase

success#

Whether the code succeeded with this test case.

Type:

bool

found#

The output of the code.

Type:

str

expected#

The expected output for this test case.

Type:

str

class codingame.Solution(state, clash_of_code, data)[source]#

Notification#

class codingame.Notification(state, data)[source]#

Represents a Notification.

id#

ID of the notification.

Type:

int

type_group#

Group type of the notification.

Type:

NotificationTypeGroup

type#

Precise type of the notification.

Type:

NotificationType

date#

Date of the notification. Was notification.creation_time.

Type:

datetime

creation_time#

Date of the notification.

Deprecated since version 1.3: Use date instead.

Type:

datetime

priority#

Priority of the notification.

Type:

int

urgent#

Whether the notification is urgent.

Type:

bool

seen#

Whether the notification has been seen.

Type:

bool

seen_date#

Date when the notification was last marked as seen.

Type:

Optional datetime

read#

Whether the notification has been read.

Type:

bool

read_date#

Date when the notification was last marked as read.

Type:

Optional datetime

data#

Data of the notification.

Note

Every notification type has different data. So there isn’t the same keys and values every time.

Type:

Optional dict

codingamer#

CodinGamer that sent the notification, only appears in some notification types.

Type:

Optional PartialCodinGamer

mark_as_seen()[source]#

This function can be a coroutine.

Mark this notification as seen.

Warning

If you want to mark multiple notifications as seen at the same time, use Client.mark_notifications_as_seen() as it only makes one API request for all the notifications instead of one API request for each notification.

Returns:

  • datetime

    The time when this notification was marked as seen.

  • .. versionadded:: 1.4

mark_as_read()[source]#

This function can be a coroutine.

Mark this notification as read.

Warning

If you want to mark multiple notifications as read at the same time, use Client.mark_notifications_as_read() as it only makes one API request for all the notifications instead of one API request for each notification.

Returns:

  • datetime

    The time when this notification was marked as read.

  • .. versionadded:: 1.4

Enumerations#

class codingame.NotificationTypeGroup[source]#

Enumeration for the Notification.type_group.

Warning

There might be some missing type groups.

achievement = 'achievement'#

Type:    str

arena = 'arena'#

Type:    str

blog = 'blog'#

Type:    str

clash = 'clash'#

Type:    str

comment = 'comment'#

Type:    str

contest = 'contest'#

Type:    str

contribution = 'contribution'#

Type:    str

feature = 'feature'#

Type:    str

hints = 'hints'#

Type:    str

moderation = 'moderation'#

Type:    str

puzzle = 'puzzle'#

Type:    str

quest = 'quest'#

Type:    str

social = 'social'#

Type:    str

xp = 'xp'#

Type:    str

generic = 'generic'#

Type:    str

custom = 'custom'#

Type:    str

other = 'other'#

Type:    str

class codingame.NotificationType[source]#

Enumeration for the Notification.type.

achievement_unlocked = 'achievement-unlocked'#

Type:    str

When a new achievement is unlocked.

new_league = 'new-league'#

Type:    str

When a new league is added to an arena.

If the new league is higher than your current one, you will get demoted, otherwise your league will stay the same.

eligible_for_next_league = 'eligible-for-next-league'#

Type:    str

When you are better than the boss of your current league.

This means you will be promoted soon.

promoted_league = 'promoted-league'#

Type:    str

When you are promoted to a higher league.

new_blog = 'new-blog'#

Type:    str

When a new blog entry is created.

clash_invite = 'clash-invite'#

Type:    str

When you are invited to a Clash of Code.

clash_over = 'clash-over'#

Type:    str

When a Clash of Code you participated in is over.

new_comment = 'new-comment'#

Type:    str

When someone comments your contribution or your solution.

new_comment_response = 'new-comment-response'#

Type:    str

When someone replies to your commeny.

contest_scheduled = 'contest-scheduled'#

Type:    str

When a contest is scheduled.

contest_soon = 'contest-soon'#

Type:    str

When a contest is starting soon.

contest_started = 'contest-started'#

Type:    str

When a contest has started.

contest_over = 'contest-over'#

Type:    str

When a contest is over.

contribution_received = 'contribution-received'#

Type:    str

When your contribution is received.

contribution_accepted = 'contribution-accepted'#

Type:    str

When your contribution is accepted.

contribution_refused = 'contribution-refused'#

Type:    str

When your contribution is refused.

contribution_clash_mode_removed = 'contribution-clash-mode-removed'#

Type:    str

When your contribution is modified.

feature = 'feature'#

Type:    str

When a new feature is available on CodinGame.

new_hint = 'new-hint'#

Type:    str

When a new hint is revealed.

contribution_moderated = 'contribution-moderated'#

Type:    str

When your contribution is validated or denied.

new_puzzle = 'new-puzzle'#

Type:    str

When a new puzzle is available.

puzzle_of_the_week = 'puzzle-of-the-week'#

Type:    str

When the puzzle of the week is available.

new_league_opened = 'new-league-opened'#

Type:    str

When a new league is opened.

I don’t know why this isn’t in NotificationTypeGroup.arena like NotificationType.new_league, NotificationType.eligible_for_next_league and NotificationType.promoted_league.

quest_completed = 'quest-completed'#

Type:    str

When a quest is completed.

following = 'following'#

Type:    str

When a CodinGamer starts following you.

friend_registered = 'friend-registered'#

Type:    str

When a friend registers on CodinGame.

invitation_accepted = 'invitation-accepted'#

Type:    str

When a friend accepts your invitation and registers on CodinGame.

new_level = 'new-level'#

Type:    str

When you reach a new level.

info_generic = 'info-generic'#

Type:    str

When you get a generic information notification.

warning_generic = 'warning-generic'#

Type:    str

When you get a generic warning notification.

important_generic = 'important-generic'#

Type:    str

When you get a generic important notification.

custom = 'custom'#

Type:    str

When you get a custom notification.

career_new_candidate = 'career-new-candidate'#

Type:    str

career_update_candidate = 'career-update-candidate'#

Type:    str

test_finished = 'test-finished'#

Type:    str

job_accepted = 'job-accepted'#

Type:    str

job_expired = 'job-expired'#

Type:    str

new_work_blog = 'new-work-blog'#

Type:    str

offer_apply = 'offer-apply'#

Type:    str

recruiter_contact = 'recruiter-contact'#

Type:    str

class codingame.ContributionType[source]#

An enumeration.

clash_of_code = 'CLASHOFCODE'#

Type:    str

puzzle_in_out = 'PUZZLE_INOUT'#

Type:    str

puzzle_solo = 'PUZZLE_SOLO'#

Type:    str

puzzle_multiplayer = 'PUZZLE_MULTI'#

Type:    str

puzzle_optimization = 'PUZZLE_OPTI'#

Type:    str

class codingame.CommentType[source]#

An enumeration.

contribution = 'CONTRIBUTION'#

Type:    str

solution = 'SOLUTION'#

Type:    str

class codingame.ContributionModeratedActionType[source]#

An enumeration.

validate = 'validate'#

Type:    str

deny = 'deny'#

Type:    str

Notification data#

class codingame.LanguageMapping(state, mapping)[source]#

Mapping to store text with multiple languages.

This class has the same interface as dict for backwards compatibility.

en#

The text in english.

Type:

str

fr#

The text in french.

Type:

str

en#

Type:    str

fr#

Type:    str

class codingame.NotificationData(state, data)[source]#

Base class for the notification data classes.

This class has the same interface as dict for backwards compatibility.

_raw#

Raw data of the Notification, useful when one of the values isn’t an attribute.

Type:

dict

classmethod from_type(type, state, data)[source]#

Create the correct NotificationData subclass according to the notification type.

Parameters:
Returns:

NotificationData

The parsed data of the notifcation.

class codingame.AchievementUnlockedData(state, data)[source]#

Data of a NotificationType.achievement_unlocked notification.

id#

Type:    str

label#

Type:    LanguageMapping

points#

Type:    int

level#

Type:    str

completion_time#

Type:    datetime

image_url#

Type:    str

class codingame.LeagueData(state, data)[source]#

Data of NotificationType.new_league, NotificationType.eligible_for_next_league, NotificationType.promoted_league and NotificationType.new_league_opened notifications.

title_label#

Type:    LanguageMapping

division_index#

Type:    int

division_count#

Type:    int

division_offset#

Type:    int

threshold_index#

Type:    int

thumbnail_url#

Type:    str

test_session_handle#

Type:    str

class codingame.NewBlogData(state, data)[source]#

Data of a NotificationType.new_blog notification.

title#

Type:    LanguageMapping

url#

Type:    LanguageMapping

class codingame.ClashInviteData(state, data)[source]#

Data of a NotificationType.clash_invite notification.

handle#

Type:    str

class codingame.ClashOverData(state, data)[source]#

Data of a NotificationType.clash_over notification.

handle#

Type:    str

rank#

Type:    int

player_count#

Type:    int

class codingame.Contribution(state, data)[source]#

Data about a contribution.

This class has the same interface as dict for backwards compatibility.

handle#

Type:    str

title#

Type:    Optional[str]

type#

Type:    Optional[ContributionType]

class codingame.PuzzleSolution(state, data)[source]#

Data about a puzzle solution.

This class has the same interface as dict for backwards compatibility.

puzzle_id#

Type:    str

puzzle_url#

Type:    Optional[str]

test_session_submission_id#

Type:    int

class codingame.NewCommentData(state, data)[source]#

Data of a NotificationType.new_comment and NotificationType.new_comment_response notifications.

type#

Type:    LanguageMapping

comment_type#

Type:    Optional[CommentType]

type_data#

Type:    Union[Contribution, PuzzleSolution, None]

url#

Type:    Optional[str]

class codingame.ContributionData(state, data)[source]#

Data of NotificationType.contribution_received, NotificationType.contribution_accepted, NotificationType.contribution_refused and NotificationType.contribution_clash_mode_removed notifications.

handle#

Type:    str

title#

Type:    Optional[str]

type#

Type:    Optional[ContributionType]

class codingame.FeatureData(state, data)[source]#

Data of a NotificationType.feature notification.

title#

Type:    Optional[LanguageMapping]

description#

Type:    LanguageMapping

image_url#

Type:    str

url#

Type:    str

class codingame.NewHintData(state, data)[source]#

Data of a NotificationType.new_hint notification.

puzzle_title#

Type:    LanguageMapping

thumbnail_url#

Type:    str

test_session_handle#

Type:    str

class codingame.ContributionModeratedData(state, data)[source]#

Data of a NotificationType.contribution_moderated notification.

action_type#

Type:    ContributionModeratedActionType

contribution#

Type:    Contribution

class codingame.NewPuzzleData(state, data)[source]#

Data of a NotificationType.new_puzzle notification.

level#

Type:    LanguageMapping

name#

Type:    LanguageMapping

image_url#

Type:    str

puzzle_id#

Type:    int

class codingame.PuzzleOfTheWeekData(state, data)[source]#

Data of a NotificationType.puzzle_of_the_week notification.

puzzle_id#

Type:    int

puzzle_level#

Type:    str

puzzle_pretty_id#

Type:    str

puzzle_name#

Type:    LanguageMapping

puzzle_image_url#

Type:    str

contributor_pseudo#

Type:    str

contributor_avatar_url#

Type:    Optional[str]

class codingame.QuestCompletedData(state, data)[source]#

Data of a NotificationType.quest_completed notification.

id#

Type:    int

label#

Type:    LanguageMapping

class codingame.FriendRegisteredData(state, data)[source]#

Data of a NotificationType.friend_registered notification.

name#

Type:    str

class codingame.NewLevelData(state, data)[source]#

Data of a NotificationType.new_level notification.

level#

Type:    int

reward#

Type:    Optional[LanguageMapping]

trigger_career_popup#

Type:    Optional[bool]

class codingame.GenericData(state, data)[source]#

Data of a NotificationType.info_generic, NotificationType.warning_generic and NotificationType.important_generic notifications.

title#

Type:    LanguageMapping

image_url#

Type:    str

description#

Type:    LanguageMapping

url#

Type:    str

class codingame.CustomData(state, data)[source]#

Data of a NotificationType.custom notification.

title#

Type:    LanguageMapping

description#

Type:    LanguageMapping

image_url#

Type:    str

url#

Type:    str

class codingame.CareerCandidateData(state, data)[source]#

Data of a NotificationType.career_new_candidate and NotificationType.career_update_candidate notifications.

handle#

Type:    str

username#

Type:    Optional[str]

country#

Type:    str

region#

Type:    str

avatar_url#

Type:    Optional[str]

class codingame.TestFinishedData(state, data)[source]#

Data of a NotificationType.test_finished notification.

campaign_id#

Type:    int

candidate_id#

Type:    int

candidate_name#

Type:    Optional[str]

candidate_email#

Type:    str

class codingame.JobAcceptedData(state, data)[source]#

Data of a NotificationType.job_accepted notification.

job_name#

Type:    Optional[str]

job_offer_location#

Type:    str

challenge_id#

Type:    Optional[int]

class codingame.JobExpiredData(state, data)[source]#

Data of a NotificationType.job_expired notification.

job_name#

Type:    Optional[str]

class codingame.NewWorkBlogData(state, data)[source]#

Data of a NotificationType.new_work_blog notification.

title#

Type:    LanguageMapping

url#

Type:    LanguageMapping

class codingame.OfferApplyData(state, data)[source]#

Data of a NotificationType.offer_apply notification.

candidate_name#

Type:    str

job_name#

Type:    Optional[str]

job_offer_location#

Type:    str

challenge_id#

Type:    Optional[int]

job_offer_id#

Type:    Optional[int]

job_offer_applicant_id#

Type:    Optional[int]

Leaderboards#

Global leaderboard#

class codingame.GlobalRankedCodinGamer(state, leaderboard, data)[source]#

Ranked CodinGamer in global leaderboard.

leaderboard#

Type:    GlobalLeaderboard

avatar#

Type:    MemberDescriptorType

property avatar_url#

Avatar URL of the CodinGamer.

Type:

Optional str

category#

Type:    MemberDescriptorType

company#

Type:    MemberDescriptorType

country_id#

Type:    MemberDescriptorType

cover#

Type:    MemberDescriptorType

property cover_url#

Cover URL of the CodinGamer.

Type:

Optional str

id#

Type:    MemberDescriptorType

level#

Type:    MemberDescriptorType

professional#

Type:    MemberDescriptorType

pseudo#

Type:    MemberDescriptorType

public_handle#

Type:    MemberDescriptorType

rank#

Type:    MemberDescriptorType

school#

Type:    MemberDescriptorType

score#

Type:    MemberDescriptorType

student#

Type:    MemberDescriptorType

class codingame.GlobalLeaderboard(state, lb_type, group, page, data)[source]#

Global leaderboard.

users#

Type:    List[GlobalRankedCodinGamer]

Global leaderboard ranking.

type#

Type:    str

Global leaderboard type. One of "GENERAL", "CONTESTS", "BOT_PROGRAMMING", "OPTIM", "CODEGOLF".

group#

Type:    str

Group of CodinGamer who are ranked. One of "global", "country", "company", "school", "following".

page#

Type:    int

Page of the leaderboard.

count#

Type:    MemberDescriptorType

Challenge leaderboard#

class codingame.League(state, data)[source]#

League in a challenge or puzzle leaserboard.

index#

Type:    int

Index of the league.

count#

Type:    int

Number of users in the league.

name#

Type:    str

Name of the league.

users#

Type:    list

Name of the league.

class codingame.ChallengeRankedCodinGamer(state, leaderboard, data)[source]#

Ranked CodinGamer in challenge leaderboards.

avatar#

Type:    MemberDescriptorType

property avatar_url#

Avatar URL of the CodinGamer.

Type:

Optional str

category#

Type:    MemberDescriptorType

company#

Type:    MemberDescriptorType

country_id#

Type:    MemberDescriptorType

cover#

Type:    MemberDescriptorType

property cover_url#

Cover URL of the CodinGamer.

Type:

Optional str

id#

Type:    MemberDescriptorType

level#

Type:    MemberDescriptorType

professional#

Type:    MemberDescriptorType

pseudo#

Type:    MemberDescriptorType

public_handle#

Type:    MemberDescriptorType

rank#

Type:    MemberDescriptorType

school#

Type:    MemberDescriptorType

score#

Type:    MemberDescriptorType

student#

Type:    MemberDescriptorType

leaderboard#

Type:    ChallengeLeaderboard

The leaderboard that this CodinGamer is part of.

percentage#

Type:    Optional[int]

Test cases completion percentage of the CodinGamer.

progress#

Type:    Optional[str]

Progress of the CodinGamer. I don’t understand what this is, so if you know, please join the support server and tell me.

programming_language#

Type:    str

The programming language used by the CodinGamer in this puzzle.

test_session_handle#

Type:    str

The handle of the test session that tested the solution of the CodinGamer.

league_rank#

Type:    Optional[int]

The rank of the CodinGamer in their league.

global_rank#

Type:    Optional[int]

The rank of the CodinGamer in the world.

league#

Type:    Optional[League]

The league of the CodinGamer in this puzzle.

class codingame.ChallengeLeaderboard(state, name, group, data)[source]#

Challenge leaderboard.

count#

Type:    MemberDescriptorType

users#

Type:    List[ChallengeRankedCodinGamer]

Challenge leaderboard ranking.

leagues#

Type:    List[League]

Leagues of the challenge. Empty list if no leagues.

has_leagues#

Type:    bool

Whether the challenge has leagues.

name#

Type:    str

Name of the challenge.

group#

Type:    str

Group of CodinGamer who are ranked. One of "global", "country", "company", "school", "following".

programming_languages#

Type:    Dict[str, int]

Number of CodinGamers who used a language in the challenge.

Puzzle leaderboard#

class codingame.PuzzleRankedCodinGamer(state, leaderboard, data)[source]#

Ranked CodinGamer in puzzle leaderboards.

avatar#

Type:    MemberDescriptorType

property avatar_url#

Avatar URL of the CodinGamer.

Type:

Optional str

category#

Type:    MemberDescriptorType

company#

Type:    MemberDescriptorType

country_id#

Type:    MemberDescriptorType

cover#

Type:    MemberDescriptorType

property cover_url#

Cover URL of the CodinGamer.

Type:

Optional str

id#

Type:    MemberDescriptorType

level#

Type:    MemberDescriptorType

professional#

Type:    MemberDescriptorType

pseudo#

Type:    MemberDescriptorType

public_handle#

Type:    MemberDescriptorType

rank#

Type:    MemberDescriptorType

school#

Type:    MemberDescriptorType

score#

Type:    MemberDescriptorType

student#

Type:    MemberDescriptorType

leaderboard#

Type:    PuzzleLeaderboard

The leaderboard that this CodinGamer is part of.

percentage#

Type:    Optional[int]

Test cases completion percentage of the CodinGamer.

progress#

Type:    Optional[str]

Progress of the CodinGamer. I don’t understand what this is, so if you know, please join the support server and tell me.

programming_language#

Type:    str

The programming language used by the CodinGamer in this puzzle.

test_session_handle#

Type:    str

The handle of the test session that tested the solution of the CodinGamer.

league_rank#

Type:    Optional[int]

The rank of the CodinGamer in their league.

global_rank#

Type:    Optional[int]

The rank of the CodinGamer in the world.

league#

Type:    Optional[League]

The league of the CodinGamer in this puzzle.

class codingame.PuzzleLeaderboard(state, name, group, data)[source]#

Puzzle leaderboard.

count#

Type:    MemberDescriptorType

users#

Type:    List[PuzzleRankedCodinGamer]

Puzzle leaderboard ranking.

leagues#

Type:    List[League]

Leagues of the puzzle. Empty list if no leagues.

has_leagues#

Type:    bool

Whether the puzzle has leagues.

name#

Type:    str

Name of the puzzle.

group#

Type:    str

Group of CodinGamer who are ranked. One of "global", "country", "company", "school", "following".

programming_languages#

Type:    Dict[str, int]

Number of CodinGamers who used a language in the puzzle.

Exceptions#

The following exceptions are thrown by the library.

exception codingame.CodinGameAPIError(message)[source]#

Base exception for the CodinGame API.

exception codingame.LoginError(message)[source]#

Raised when the login data is incorrect.

exception codingame.EmailRequired(message)[source]#

Raised when the email given at login is empty.

exception codingame.MalformedEmail(message)[source]#

Raised when the email given at login isn’t well formed.

exception codingame.PasswordRequired(message)[source]#

Raised when the password given at login is empty.

exception codingame.EmailNotLinked(message)[source]#

Raised when the email given at login isn’t linked to a CodinGamer account.

exception codingame.IncorrectPassword(message)[source]#

Raised when the password given at login is incorrect.

exception codingame.WrongCaptchaAnswer(message)[source]#

Raised when the captcha in the email/password login is incorrect.

See Login to fix this

exception codingame.LoginRequired(message=None)[source]#

Raised when an action requires the client to log in.

exception codingame.NotFound(message)[source]#

Raised when something isn’t found.

exception codingame.CodinGamerNotFound(message)[source]#

Raised when a CodinGamer isn’t found.

exception codingame.ChallengeNotFound(message)[source]#

Raised when a Challenge isn’t found.

exception codingame.PuzzleNotFound(message)[source]#

Raised when a Puzzle isn’t found.

exception codingame.ClashOfCodeError(message)[source]#

Raised when there is an error with a Clash of Code.

exception codingame.ClashOfCodeNotFound(message)[source]#

Raised when a Clash of Code isn’t found.

exception codingame.ClashOfCodeCancelled(message)[source]#

Raised when trying to join a Clash of Code that was cancelled.

exception codingame.ClashOfCodeStarted(message)[source]#

Raised when trying to join an already started Clash of Code.

exception codingame.ClashOfCodeFinished(message)[source]#

Raised when trying to join an already finished Clash of Code.

exception codingame.ClashOfCodeFull(message)[source]#

Raised when trying to join a Clash of Code that reached the maximum number of players.

Exception Hierarchy#