Killmail Handling

EVE-SRP relies on outside sources for its killmail information. Whether that source is CREST, zKillboard, or some private killboard does not matter, there just has to be some sort of access to the information somehow. Included with EVE-SRP is support for CREST verified killmails and zKillboard based killboards.

The interface for Killmail is fairly simple. It provides a number of attributes, and for those that correspond to in-game entities, it also provides their ID number. The default implementation has all values set to None. Two implementations for creating a Killmail from a URL are provided: CRESTMail is created from a CREST external killmail link, and ZKillmail is created from a zKillboard details link.

Extension Example

The intent of having killmails handled in a separate class was for administrators to be able to have customized behavior. As an example, here’s a Killmail subclass that will link the ship name to the Eve-Online wiki page for that ship, and only accept killmails from the TEST Alliance killboard.

from evesrp.killmail import ZKillmail, ShipURLMixin


eve_wiki_url = 'https://wiki.eveonline.com/en/wiki/{name}'
EveWikiMixin = ShipURLMixin(eve_wiki_url)


class TestZKillmail(ZKillmail, EveWikiMixin):
    def __init__(self, *args, **kwargs):
        super(TestZKillmail, self).__init__(*args, **kwargs)
        if self.domain not in ('zkb.pleaseignore.com', 'kb.pleaseignore.com'):
            raise ValueError("This killmail is from the wrong killboard.")

API

class evesrp.killmail.Killmail(**kwargs)[source]

Base killmail representation.

kill_id

The ID integer of this killmail. Used by most killboards and by CCP to refer to killmails.

ship_id

The typeID integer of for the ship lost for this killmail.

ship

The human readable name of the ship lost for this killmail.

ship_url

This is an optional atribute for subclasses to implement. It’s intended to be used for requests to link to a custom, possibly external, ship-specific page.

pilot_id

The ID number of the pilot who lost the ship. Referred to by CCP as characterID.

pilot

The name of the pilot who lost the ship.

corp_id

The ID number of the corporation pilot belonged to at the time this kill happened.

corp

The name of the corporation referred to by corp_id.

alliance_id

The ID number of the alliance corp belonged to at the time of this kill, or None if the corporation wasn’t in an alliance at the time.

alliance

The name of the alliance referred to by alliance_id.

url

A URL for viewing this killmail’s information later. Typically an online killboard such as zKillboard <https://zkillboard.com>, but other kinds of links may be used.

value

The extimated ISK loss for the ship destroyed in this killmail. This is an optional attribute, and is None if unsupported. If this attribute is set, it should be a Decimal or a type that can be used as the value for the Decimal constructor.

timestamp

The date and time that this kill occured as a datetime.datetime object (with a UTC timezone).

verified

Whether or not this killmail has been API verified (or more accurately, if it is to be trusted when making a Request.

system
system_id
constellation
region

The system/constellation/region where the kill occured.

__init__(**kwargs)[source]

Initialize a Killmail with None for all attributes.

All subclasses of this class, (and all mixins designed to be used with it) must call super().__init__(**kwargs) to ensure all initialization is done.

Param:keyword arguments corresponding to attributes.
__iter__()[source]

Iterate over the attributes of this killmail.

Yields tuples in the form ('<name>', <value>). This is used by evesrp.models.Request.__init__() to initialize its data quickly. The <name> in the returned tuples is the name of the attribute on the Request.

description = 'A generic Killmail. If you see this text, you need toreconfigure your application.'

A user-facing description of what killmails this Killmail validates/handles.

class evesrp.killmail.ZKillmail(url, **kwargs)[source]

Bases: evesrp.killmail.Killmail, evesrp.killmail.RequestsSessionMixin, evesrp.killmail.ShipNameMixin, evesrp.killmail.LocationMixin

A killmail sourced from a zKillboard based killboard.

domain

The domain name of this killboard.

__init__(url, **kwargs)[source]

Create a killmail from the given URL.

Parameters:

url (str) – The URL of the killmail.

Raises:
  • ValueError – if url isn’t a valid zKillboard killmail.
  • LookupError – if the zKillboard API response is in an unexpected format.
class evesrp.killmail.CRESTMail(url, **kwargs)[source]

Bases: evesrp.killmail.Killmail, evesrp.killmail.RequestsSessionMixin, evesrp.killmail.LocationMixin

A killmail with data sourced from a CREST killmail link.

__init__(url, **kwargs)[source]

Create a killmail from a CREST killmail link.

Parameters:

url (str) – the CREST killmail URL.

Raises:
  • ValueError – if url is not a CREST URL.
  • LookupError – if the CREST API response is in an unexpected format.
class evesrp.killmail.RequestsSessionMixin(requests_session=None, **kwargs)[source]

Mixin for providing a requests.Session.

The shared session allows HTTP user agents to be set properly, and for possible connection pooling.

requests_session

A Session for making HTTP requests.

__init__(requests_session=None, **kwargs)[source]

Set up a Session for making HTTP requests.

If an existing session is not provided, one will be created.

Parameters:requests_session – an existing session to use.
class evesrp.killmail.ShipNameMixin[source]

Killmail mixin providing Killmail.ship from Killmail.ship_id.

ship[source]

Looks up the ship name using Killmail.ship_id.

class evesrp.killmail.LocationMixin[source]

Killmail mixin for providing solar system, constellation and region names from Killmail.system_id.

constellation[source]

Provides the constellation name using Killmail.system_id.

region[source]

Provides the region name using Killmail.system_id.

system[source]

Provides the solar system name using Killmail.system_id.

Table Of Contents

Previous topic

Authentication

Next topic

Views

This Page