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:
objectChannel - Represents an authenticated connection over a physical socket
-
__init__(connection, token)[source]¶ Initialize a channel.
Properties:
- connection:
Connectionobject from which this channel originated. - token: Channel token, used to identify channel on server.
- game_id_to_instances: Dictionary mapping a game ID to
NetworkGameobjects loaded for this game. EachNetworkGamehas 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 aGameInstancesSet, which makes sure that there will be at most 1NetworkGameinstance per possible role.
Parameters: - connection (diplomacy.client.connection.Connection) – a Connection object.
- token (str) – Channel token.
- connection:
-
create_game(game=None, **kwargs)¶ Send request
CreateGamewith request parameterskwargs. Return response data returned by server for this request. SeeCreateGameabout request parameters and response.
-
get_available_maps(game=None, **kwargs)¶ Send request
GetAvailableMapswith request parameterskwargs. Return response data returned by server for this request. SeeGetAvailableMapsabout request parameters and response.
-
get_playable_powers(game=None, **kwargs)¶ Send request
GetPlayablePowerswith request parameterskwargs. Return response data returned by server for this request. SeeGetPlayablePowersabout request parameters and response.
-
join_game(game=None, **kwargs)¶ Send request
JoinGamewith request parameterskwargs. Return response data returned by server for this request. SeeJoinGameabout request parameters and response.
-
join_powers(game=None, **kwargs)¶ Send request
JoinPowerswith request parameterskwargs. Return response data returned by server for this request. SeeJoinPowersabout request parameters and response.
-
list_games(game=None, **kwargs)¶ Send request
ListGameswith request parameterskwargs. Return response data returned by server for this request. SeeListGamesabout request parameters and response.
-
get_games_info(game=None, **kwargs)¶ Send request
GetGamesInfowith request parameterskwargs. Return response data returned by server for this request. SeeGetGamesInfoabout request parameters and response.
-
get_dummy_waiting_powers(game=None, **kwargs)¶ Send request
GetDummyWaitingPowerswith request parameterskwargs. Return response data returned by server for this request. SeeGetDummyWaitingPowersabout request parameters and response.
-
delete_account(game=None, **kwargs)¶ Send request
DeleteAccountwith request parameterskwargs. Return response data returned by server for this request. SeeDeleteAccountabout request parameters and response.
-
logout(game=None, **kwargs)¶ Send request
Logoutwith request parameterskwargs. Return response data returned by server for this request. SeeLogoutabout request parameters and response.
-
make_omniscient(game=None, **kwargs)¶ Send request
SetGradewith forced parameters(grade=omniscient, grade_update=promote)and additional request parameterskwargs. Return response data returned by server for this request. SeeSetGradeabout request parameters and response.
-
remove_omniscient(game=None, **kwargs)¶ Send request
SetGradewith forced parameters(grade=omniscient, grade_update=demote)and additional request parameterskwargs. Return response data returned by server for this request. SeeSetGradeabout request parameters and response.
-
promote_administrator(game=None, **kwargs)¶ Send request
SetGradewith forced parameters(grade=admin, grade_update=promote)and additional request parameterskwargs. Return response data returned by server for this request. SeeSetGradeabout request parameters and response.
-
demote_administrator(game=None, **kwargs)¶ Send request
SetGradewith forced parameters(grade=admin, grade_update=demote)and additional request parameterskwargs. Return response data returned by server for this request. SeeSetGradeabout request parameters and response.
-