diplomacy.client.channel

Channel

  • The channel object represents an authenticated connection over a socket.
  • It has a token that it sends with every request to authenticate itself.
class diplomacy.client.channel.Channel(connection, token)[source]

Bases: object

Channel - Represents an authenticated connection over a physical socket

__init__(connection, token)[source]

Initialize a channel.

Properties:

  • connection: Connection object from which this channel originated.
  • token: Channel token, used to identify channel on server.
  • game_id_to_instances: Dictionary mapping a game ID to NetworkGame objects loaded for this game. Each NetworkGame has a specific role, which is either an observer role, an omniscient role, or a power (player) role. Network games for a specific game ID are managed within a GameInstancesSet, which makes sure that there will be at most 1 NetworkGame instance per possible role.
Parameters:
create_game(game=None, **kwargs)

Send request CreateGame with request parameters kwargs. Return response data returned by server for this request. See CreateGame about request parameters and response.

get_available_maps(game=None, **kwargs)

Send request GetAvailableMaps with request parameters kwargs. Return response data returned by server for this request. See GetAvailableMaps about request parameters and response.

get_playable_powers(game=None, **kwargs)

Send request GetPlayablePowers with request parameters kwargs. Return response data returned by server for this request. See GetPlayablePowers about request parameters and response.

join_game(game=None, **kwargs)

Send request JoinGame with request parameters kwargs. Return response data returned by server for this request. See JoinGame about request parameters and response.

join_powers(game=None, **kwargs)

Send request JoinPowers with request parameters kwargs. Return response data returned by server for this request. See JoinPowers about request parameters and response.

list_games(game=None, **kwargs)

Send request ListGames with request parameters kwargs. Return response data returned by server for this request. See ListGames about request parameters and response.

get_games_info(game=None, **kwargs)

Send request GetGamesInfo with request parameters kwargs. Return response data returned by server for this request. See GetGamesInfo about request parameters and response.

get_dummy_waiting_powers(game=None, **kwargs)

Send request GetDummyWaitingPowers with request parameters kwargs. Return response data returned by server for this request. See GetDummyWaitingPowers about request parameters and response.

delete_account(game=None, **kwargs)

Send request DeleteAccount with request parameters kwargs. Return response data returned by server for this request. See DeleteAccount about request parameters and response.

logout(game=None, **kwargs)

Send request Logout with request parameters kwargs. Return response data returned by server for this request. See Logout about request parameters and response.

make_omniscient(game=None, **kwargs)

Send request SetGrade with forced parameters (grade=omniscient, grade_update=promote) and additional request parameters kwargs. Return response data returned by server for this request. See SetGrade about request parameters and response.

remove_omniscient(game=None, **kwargs)

Send request SetGrade with forced parameters (grade=omniscient, grade_update=demote) and additional request parameters kwargs. Return response data returned by server for this request. See SetGrade about request parameters and response.

promote_administrator(game=None, **kwargs)

Send request SetGrade with forced parameters (grade=admin, grade_update=promote) and additional request parameters kwargs. Return response data returned by server for this request. See SetGrade about request parameters and response.

demote_administrator(game=None, **kwargs)

Send request SetGrade with forced parameters (grade=admin, grade_update=demote) and additional request parameters kwargs. Return response data returned by server for this request. See SetGrade about request parameters and response.

promote_moderator(game=None, **kwargs)

Send request SetGrade with forced parameters (grade=moderator, grade_update=promote) and additional request parameters kwargs. Return response data returned by server for this request. See SetGrade about request parameters and response.

demote_moderator(game=None, **kwargs)

Send request SetGrade with forced parameters (grade=moderator, grade_update=demote) and additional request parameters kwargs. Return response data returned by server for this request. See SetGrade about request parameters and response.