modules

class esy.client.ESICallableOperation(operation)[source]

Wraps bravado’s CallableOpeartion to handle pagination

class esy.client.ESIClient(swagger_spec, esi_endpoint, user_agent, use_models, cache)[source]

Swagger client interface adapted to use with the ESI.

static get_client(user_agent='esy//vittoros@slack', use_models=False, spec=None, endpoint='https://esi.evetech.net/latest/swagger.json', datasource='tranquility', cache=None)[source]

Generates a client interface for ESI.

Parameters:
  • user_agent (str) –
  • use_models
  • spec
  • endpoint (str) –
  • datasource (str) –
  • cache – A class which implements the cache interface
Returns:

An initalized client

Return type:

ESIClient

static get_swagger_spec(endpoint='https://esi.evetech.net/latest/swagger.json', datasource='tranquility', cache=None)[source]

Downloads and parses the swagger specification from the ESI endpoint.

Parameters:
  • endpoint (str) – URL to the ESI endpoint. Defaults to latest.
  • datasource (str) – ESI datasource to use. Defaults to Tranquility.
  • cache – Optional cache
Returns:

Swagger specification

Return type:

dict

class esy.client.ESIPageGenerator(requests_future, requestsresponse_adapter, operation, response_callbacks, request_config, cache=None)[source]

Generator for ESI API calls.

class esy.client.ESIRequestsClient(user_agent, cache=None)[source]

Extends the bravado RequestsClient to handle pagination, user agent and per-request authorizations.

request(request_params, operation=None, response_callbacks=None, request_config=None, authorization_token=None)[source]
Parameters:
  • request_params (dict) – complete request data.
  • operation (bravado_core.operation.Operation) – operation that this http request is for. Defaults to None - in which case, we’re obviously just retrieving a Swagger Spec.
  • request_config (RequestConfig) – per-request configuration
Returns:

HTTP Future object

Return type:

class:bravado_core.http_future.HttpFuture

class esy.client.ESIResourceDecorator(resource, also_return_response=False)[source]

Extends ResourceDecorator to wrap operations with ESICallableOperation

exception esy.exceptions.ESIAuthorizationError[source]
exception esy.exceptions.ESIError[source]
exception esy.exceptions.ESIForbidden[source]
exception esy.exceptions.ESINotFound[source]
class esy.auth.ESIAuthenticator(access_token_endpoint='https://login.eveonline.com/oauth/token', token_verify_endpoint='https://login.eveonline.com/oauth/verify', revoke_token_endpoint='https://login.eveonline.com/oauth/revoke')[source]

Handles ESI token authentication and verification process.

get_access_token(refresh_token, client_id, secret, session=None, auth=None)[source]

Get a new access token using a refresh token

Parameters:
  • refresh_token (str) – The refresh token
  • client_id (str) – The ESI ClientID
  • secret (str) – The ESI Secret key
  • session (OAuth2Session) – Existing session for reuse
  • auth (HTTPBasicAuth) – Existing authentication handler for reuse
Returns:

New access token

Return type:

str

revoke_token(token, client_id, secret, token_type='refresh_token', session=None, auth=None)[source]

Revoke refresh or access tokens.

Parameters:
  • token (str) – The token to revoke
  • client_id (str) – The ESI ClientID
  • secret (str) – The ESI Secret key
  • token_type (str) – Token type to request from ESI
  • session (OAuth2Session) – Existing session for reuse
  • auth (HTTPBasicAuth) – Existing authentication handler for reuse
Returns:

Token revocation status

Return type:

bool

verify_access_token(access_token)[source]

Verifies the refresh token with the ESI and retrieves character information.

Parameters:access_token (str) – ESI access token
Returns:dict with CharacterID, CharacterName and CharacterOwnerHash
Return type:dict
verify_authorization_code(authorization_code, client_id, secret)[source]

Trades an authorization code for a refresh and an access tokens from ESI

Parameters:
  • authorization_code (str) – The authorization code returned from ESI
  • client_id (str) – The ESI ClientID
  • secret (str) – The ESI Secret key
Returns:

(refresh_token, access_token)

Return type:

tuple

class esy.devel.AuthenticationHandler(request, client_address, server)[source]

HTTP Request handler that pilfers the state and authorization code from an incoming request.

class esy.devel.DevServer(server_address)[source]

Tiny HTTP Server used to listen for incoming redirects from ESI, so we can snatch the authorization code.

run()[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

esy.devel.get_authorization_code(cli_login=False, server_address='localhost', server_port='8000', client_id=None, callback_url='http://localhost:8000', scopes=None, character_id=None, username=None, password=None)[source]

Starts an SSO session with ESI and retrieves the authorization code. Optionally prompts for username and password input, and character selection.

Parameters:
  • cli_login (bool) – Start CLI-based authentication or just print the SSO URL.
  • server_address (str) – The address DevServer is binding to.
  • server_port (str or int) – The port DevServer is listening on.
  • client_id (str) – The ESI ClientID
  • callback_url (str) – The ESI CallbackURL
  • scopes (str) – The selected ESI scopes, as space-delimited string.
  • character_id (str or int) – Pre-selected CharacterId to authorize
  • username (str) – EVE Online SSO username
  • password (str) – EVE Online SSO password
Returns:

authorization code

Return type:

str