API Reference

pnwkit

pnwkit.pnwkit = <pnwkit.sync.SyncKit object>

An instance of SyncKit for synchronous interactions with the API.

Note

All methods of this instance can be accessed from the root pnwkit module. I.e. pnwkit.alliance_query as opposed to pnwkit.pnwkit.alliance_query.

async_pnwit

pnwkit.async_pnwkit = <pnwkit.async_.AsyncKit object>

An instance of AsyncKit for asynchronous interactions with the API.

Note

All methods of this instance can be accessed from the root pnwkit module with prefix async_. I.e. pnwkit.async_alliance_query as opposed to pnwkit.async_pnwkit.alliance_query.

set_key

pnwkit.set_key(api_key: str)None

Sets the default API key and the API key on the pnwkit and async_pnwkit instances.

Parameters

api_key (str) – A Politics and War API Key.

Kit

class pnwkit.core.Kit(api_key: Optional[str] = ..., *, async_: Literal[False] = 'False', **kwargs: Any)
class pnwkit.core.Kit(api_key: Optional[str] = ..., *, async_: Literal[True] = 'True', **kwargs: Any)

Class for the creation of a kit.

For simple creation of a SyncKit or AsyncKit

Returns

SyncKit if async_ is False, AsyncKit if async_ is True.

Return type

Union[AsyncKit, SyncKit]

SyncKit

class pnwkit.sync.SyncKit(api_key: Optional[str] = None, bot_key: Optional[str] = None)
alliance_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Tuple[Alliance, ...]
alliance_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Alliance]

Makes a query to the alliances endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Alliances representing the data retrived. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Alliance, …], Paginator[Alliance]]

bank_deposit_mutation(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], **variables: Any)Bankrec

Executes the bank deposit mutation.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass into the mutation.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • **variables (Any) – The variables to pass in with the query.

Returns

The Bankrec object representing the transaction completed.

Return type

Bankrec

bank_withdraw_mutation(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], **variables: Any)Bankrec

Executes the bank withdraw mutation.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass into the mutation.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • **variables (Any) – The variables to pass in with the query.

Returns

The Bankrec object representing the transaction completed.

Return type

Bankrec

bankrec_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Tuple[Bankrec, ...]
bankrec_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Bankrec]

Makes a query to the bankrecs endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Bankrecs representing the data retrived. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Bankrec, …], Paginator[Bankrec]]

bbgame_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Tuple[BBGame, ...]
bbgame_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.BBGame]

Makes a query to the bbgames endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of BBGames representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[BBGame, …], Paginator[BBGame]]

bbplayer_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Tuple[BBPlayer, ...]
bbplayer_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.BBPlayer]

Makes a query to the bbplayers endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of BBPlayers representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[BBPlayer, …], Paginator[BBPlayer]]

bbteam_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Tuple[BBTeam, ...]
bbteam_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.BBTeam]

Makes a query to the bbteams endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of BBTeams representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[BBTeam, …], Paginator[BBTeam]]

bounty_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Tuple[Bounty, ...]
bounty_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Bounty]

Makes a query to the bountys endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Bountys representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Bounty, …], Paginator[Bounty]]

city_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Tuple[City, ...]
city_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.City]

Makes a query to the citys endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Citys representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[City, …], Paginator[City]]

color_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]])Tuple[Color, ...]

Makes a query to the colors endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

Returns

A tuple of Colors representing the data retrived.

Return type

Tuple[Color, …]

game_info_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]])GameInfo

Makes a query to the game_info endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

Returns

The GameInfo object representing the data retrieved.

Return type

GameInfo

me_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]])ApiKeyDetails

Makes a query to the me endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

Returns

The ApiKeyDetails object representing the data retrieved.

Return type

ApiKeyDetails

nation_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Tuple[Nation, ...]
nation_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Nation]

Makes a query to the nations endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Nations representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Nation, …], Paginator[Nation]]

trade_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Tuple[Trade, ...]
trade_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Trade]

Makes a query to the trades endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Trades representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Trade, …], Paginator[Trade]]

tradeprice_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Tuple[Tradeprice, ...]
tradeprice_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Tradeprice]

Makes a query to the tradeprices endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Tradeprices representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Tradeprice, …], Paginator[Tradeprice]]

treasure_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]])Tuple[Treasure, ...]

Makes a query to the treasures endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

Returns

A tuple of Treasures representing the data retrived.

Return type

Tuple[Treasure, …]

treaty_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Tuple[Treaty, ...]
treaty_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Treaty]

Makes a query to the treaties endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Treaties representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Treaty, …], Paginator[Treaty]]

war_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Tuple[War, ...]
war_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.War]

Makes a query to the wars endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Wars representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[War, …], Paginator[War]]

warattack_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Tuple[WarAttack, ...]
warattack_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.WarAttack]

Makes a query to the warattacks endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of WarAttacks representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[WarAttack, …], Paginator[WarAttack]]

AsyncKit

class pnwkit.async_.AsyncKit(api_key: Optional[str] = None, bot_key: Optional[str] = None)
alliance_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Coroutine[Any, Any, Tuple[Alliance, ...]]
alliance_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Alliance]

Makes a query to the alliances endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Alliances representing the data retrived. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Alliance, …], Paginator[Alliance]]

bank_deposit_mutation(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], **variables: Any)Coroutine[Any, Any, Bankrec]

Executes the bank deposit mutation.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass into the mutation.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • **variables (Any) – The variables to pass in with the query.

Returns

The Bankrec object representing the transaction completed.

Return type

Bankrec

bank_withdraw_mutation(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], **variables: Any)Coroutine[Any, Any, Bankrec]

Executes the bank withdraw mutation.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass into the mutation.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • **variables (Any) – The variables to pass in with the query.

Returns

The Bankrec object representing the transaction completed.

Return type

Bankrec

bankrec_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Coroutine[Any, Any, Tuple[Bankrec, ...]]
bankrec_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Bankrec]

Makes a query to the bankrecs endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Bankrecs representing the data retrived. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Bankrec, …], Paginator[Bankrec]]

bbgame_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Coroutine[Any, Any, Tuple[BBGame, ...]]
bbgame_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.BBGame]

Makes a query to the bbgames endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of BBGames representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[BBGame, …], Paginator[BBGame]]

bbplayer_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Coroutine[Any, Any, Tuple[BBPlayer, ...]]
bbplayer_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.BBPlayer]

Makes a query to the bbplayers endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of BBPlayers representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[BBPlayer, …], Paginator[BBPlayer]]

bbteam_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Coroutine[Any, Any, Tuple[BBTeam, ...]]
bbteam_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.BBTeam]

Makes a query to the bbteams endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of BBTeams representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[BBTeam, …], Paginator[BBTeam]]

bounty_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Coroutine[Any, Any, Tuple[Bounty, ...]]
bounty_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Bounty]

Makes a query to the bountys endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Bountys representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Bounty, …], Paginator[Bounty]]

city_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Coroutine[Any, Any, Tuple[City, ...]]
city_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.City]

Makes a query to the citys endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Citys representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[City, …], Paginator[City]]

color_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]])Coroutine[Any, Any, Tuple[Color, ...]]

Makes a query to the colors endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

Returns

A tuple of Colors representing the data retrived.

Return type

Tuple[Color, …]

game_info_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]])Coroutine[Any, Any, GameInfo]

Makes a query to the game_info endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

Returns

The GameInfo object representing the data retrieved.

Return type

GameInfo

me_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]])Union[Coroutine[Any, Any, ApiKeyDetails], ApiKeyDetails]

Makes a query to the me endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

Returns

The ApiKeyDetails object representing the data retrieved.

Return type

ApiKeyDetails

nation_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Coroutine[Any, Any, Tuple[Nation, ...]]
nation_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Nation]

Makes a query to the nations endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Nations representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Nation, …], Paginator[Nation]]

trade_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Coroutine[Any, Any, Tuple[Trade, ...]]
trade_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Trade]

Makes a query to the trades endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Trades representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Trade, …], Paginator[Trade]]

tradeprice_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Coroutine[Any, Any, Tuple[Tradeprice, ...]]
tradeprice_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Tradeprice]

Makes a query to the tradeprices endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Tradeprices representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Tradeprice, …], Paginator[Tradeprice]]

treasure_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]])Coroutine[Any, Any, Tuple[Treasure, ...]]

Makes a query to the treasures endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

Returns

A tuple of Treasures representing the data retrived.

Return type

Tuple[Treasure, …]

treaty_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Coroutine[Any, Any, Tuple[Treaty, ...]]
treaty_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.Treaty]

Makes a query to the treaties endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Treaties representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[Treaty, …], Paginator[Treaty]]

war_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Coroutine[Any, Any, Tuple[War, ...]]
war_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.War]

Makes a query to the wars endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of Wars representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[War, …], Paginator[War]]

warattack_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = False, **variables: Any)Coroutine[Any, Any, Tuple[WarAttack, ...]]
warattack_query(params: MutableMapping[str, Any], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = False, **variables: Any)pnwkit.paginator.Paginator[pnwkit.data.WarAttack]

Makes a query to the warattacks endpoint.

Parameters
  • params (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the parameters to pass in the query to filter results.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated to form the portion of the query string containing the attributes to fetch.

  • paginator (bool) – Whether to return the result as a Paginator, by default False.

  • **variables (Any) – The variables to pass in with the query.

Returns

A tuple of WarAttacks representing the data retrieved. If paginator is True then will return an Paginator.

Return type

Union[Tuple[WarAttack, …], Paginator[WarAttack]]

Paginator

class pnwkit.paginator.Paginator(paginator_info: Optional[PaginatorInfo], endpoint: str, kit: Union[SyncKit, AsyncKit], params: MutableMapping[str, Any], args: Tuple[Union[str, Any], ...], variables: Dict[str, Any], type: Type[T])

Represents a paginator.

paginator_info

The paginator info for the current page.

Type

Optional[PaginatorInfo]

first_paginator_info

The paginator info for the first page.

Type

Optional[PaginatorInfo]

kit

The kit used to query the API.

Type

Union[SyncKit, AsyncKit]

Note

This class is intended to be used as an iterator with a for or async for loop.