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. EachNetworkGame
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 aGameInstancesSet
, which makes sure that there will be at most 1NetworkGame
instance per possible role.
Parameters: - connection (diplomacy.client.connection.Connection) – a Connection object.
- token (str) – Channel token.
- connection:
-
create_game
(game=None, **kwargs)¶ Send request
CreateGame
with request parameterskwargs
. Return response data returned by server for this request. SeeCreateGame
about request parameters and response.
-
get_available_maps
(game=None, **kwargs)¶ Send request
GetAvailableMaps
with request parameterskwargs
. Return response data returned by server for this request. SeeGetAvailableMaps
about request parameters and response.
-
get_playable_powers
(game=None, **kwargs)¶ Send request
GetPlayablePowers
with request parameterskwargs
. Return response data returned by server for this request. SeeGetPlayablePowers
about request parameters and response.
-
join_game
(game=None, **kwargs)¶ Send request
JoinGame
with request parameterskwargs
. Return response data returned by server for this request. SeeJoinGame
about request parameters and response.
-
join_powers
(game=None, **kwargs)¶ Send request
JoinPowers
with request parameterskwargs
. Return response data returned by server for this request. SeeJoinPowers
about request parameters and response.
-
list_games
(game=None, **kwargs)¶ Send request
ListGames
with request parameterskwargs
. Return response data returned by server for this request. SeeListGames
about request parameters and response.
-
get_games_info
(game=None, **kwargs)¶ Send request
GetGamesInfo
with request parameterskwargs
. Return response data returned by server for this request. SeeGetGamesInfo
about request parameters and response.
-
get_dummy_waiting_powers
(game=None, **kwargs)¶ Send request
GetDummyWaitingPowers
with request parameterskwargs
. Return response data returned by server for this request. SeeGetDummyWaitingPowers
about request parameters and response.
-
delete_account
(game=None, **kwargs)¶ Send request
DeleteAccount
with request parameterskwargs
. Return response data returned by server for this request. SeeDeleteAccount
about request parameters and response.
-
logout
(game=None, **kwargs)¶ Send request
Logout
with request parameterskwargs
. Return response data returned by server for this request. SeeLogout
about request parameters and response.
-
make_omniscient
(game=None, **kwargs)¶ Send request
SetGrade
with forced parameters(grade=omniscient, grade_update=promote)
and additional request parameterskwargs
. Return response data returned by server for this request. SeeSetGrade
about request parameters and response.
-
remove_omniscient
(game=None, **kwargs)¶ Send request
SetGrade
with forced parameters(grade=omniscient, grade_update=demote)
and additional request parameterskwargs
. Return response data returned by server for this request. SeeSetGrade
about request parameters and response.
-
promote_administrator
(game=None, **kwargs)¶ Send request
SetGrade
with forced parameters(grade=admin, grade_update=promote)
and additional request parameterskwargs
. Return response data returned by server for this request. SeeSetGrade
about request parameters and response.
-
demote_administrator
(game=None, **kwargs)¶ Send request
SetGrade
with forced parameters(grade=admin, grade_update=demote)
and additional request parameterskwargs
. Return response data returned by server for this request. SeeSetGrade
about request parameters and response.
-