pyzkb package

Submodules

pyzkb.pyzkb module

exception pyzkb.pyzkb.InvalidModifier(msg)[source]

Bases: exceptions.ValueError

class pyzkb.pyzkb.ZKillboard(base_url='https://zkillboard.com/api/', modifier_validation=True, user_agent='pyZKB 0.1a')[source]

Bases: object

ZKillboard API interface

ZKillboard is a chain-able class, allowing for modifiers to be passed as a function chain as well as arguments on the get call.

Parameters:
  • base_url (str) – Base API URL of the ZKB instance you want to use (defaults to zkillboard.com).
  • modifier_validation (bool) – Enables the modifier validation functions.
  • user_agent (str) – User agent to use when calling the API.
get(**kwargs)[source]

Calls the ZKB API with the modifiers specified

Parameters:

**kwargs – Additional modifiers

Returns:

(headers, result)

Return type:

tuple

Raises:
  • ValueError – If the modifier has been provided an invalid values.
  • InvalidModifier – If the modifier doesn’t exist or is incorrectly used.

Examples

Modifiers can be provided directly to the get call.

>>> x = ZKillboard()
>>> x.get(killID=12345)

Or provided as part of a chained call for the class

>>> x = ZKillboard()
>>> x.killID(12345).get()
x = 'xml'
y = False

Module contents