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, **kwargs: Any)
alliance_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = 'False', **kwargs: Any)Tuple[pnwkit.data.Alliance, ...]
alliance_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = 'True', **kwargs: Any)pnwkit.paginator.AlliancePaginator

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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

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

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

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

Return type

Union[Tuple[Alliance], AlliancePaginator]

color_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], **kwargs: Any)Tuple[pnwkit.data.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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

A tuple of Colors representing the data retrived.

Return type

Tuple[Color]

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

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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

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

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

A tuple of Nations representing the data retrived. If paginator is True then will return a NationPaginator.

Return type

Union[Tuple[Nation], NationPaginator]

trade_price_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], **kwargs: Any)Tuple[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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

A tuple of Tradeprices representing the data retrived.

Return type

Tuple[Tradeprice]

trade_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], **kwargs: Any)Tuple[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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

A tuple of Trades representing the data retrived.

Return type

Tuple[Trade]

treasure_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], **kwargs: Any)Tuple[pnwkit.data.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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

A tuple of Treasures representing the data retrived.

Return type

Tuple[Treasure]

war_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], **kwargs: Any)Tuple[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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

A tuple of Wars representing the data retrived.

Return type

Tuple[War]

AsyncKit

class pnwkit.async_.AsyncKit(api_key: Optional[str] = None, **kwargs: Any)
async alliance_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = 'False', **kwargs: Any)Tuple[Alliance, ...]
async alliance_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = 'True', **kwargs: Any)pnwkit.paginator.AlliancePaginator

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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

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

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

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

Return type

Union[Tuple[Alliance], AlliancePaginator]

async color_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], **kwargs: 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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

A tuple of Colors representing the data retrived.

Return type

Tuple[Color]

async nation_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], paginator: Literal[False] = 'False', **kwargs: Any)Tuple[Nation, ...]
async nation_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], paginator: Literal[True] = 'True', **kwargs: Any)pnwkit.paginator.NationPaginator

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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

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

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

A tuple of Nations representing the data retrived. If paginator is True then will return a NationPaginator.

Return type

Union[Tuple[Nation], NationPaginator]

async trade_price_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], **kwargs: Any)Tuple[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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

A tuple of Tradeprices representing the data retrived.

Return type

Tuple[Tradeprice]

async trade_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], **kwargs: Any)Tuple[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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

A tuple of Trades representing the data retrived.

Return type

Tuple[Trade]

async treasure_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], **kwargs: 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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

A tuple of Treasures representing the data retrived.

Return type

Tuple[Treasure]

async war_query(params: MutableMapping[str, Any], arg: Union[str, Mapping[str, Any]], *args: Union[str, Mapping[str, Any]], **kwargs: Any)Tuple[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.

  • arg (Union[str, Mapping[str, Any]]) – A string, dict, or other mapping of the data to retrieve.

  • *args (Union[str, Mapping[str, Any]]) – Will be concatenated with arg to form the string of data to retrieve.

  • **kwargs (Any) – If params is falsy, then extra kwargs will be used as params.

Returns

A tuple of Wars representing the data retrived.

Return type

Tuple[War]