EsiPy - A python swagger lib for ESI

library
esi

(Althalus Stenory) #1

Version PyVersion

EsiPy is a python library for ESI API that dynamically generate everything using the swagger.json.

It is written on top of pyswagger (which does the boring stuff) but rewrites some objects from it, to add functionalities to deal with some specific use case:

  • EVE SSO Auth (generate auth url, tokens stuff, adds the Bearer header)
  • Caching the responses
  • Auto retry on 5xx error and parallel requests

The library is compatible with python 2.7 and 3.3+.
 

How to get started with EsiPy

Simply include it in your project using pip install esipy and there you are !
 

Documentations / examples ? I have questions / issues

You can find a complete (I hope so) documentation and some examples here:
Doc

If you have any issue, questions or maybe you need a little help, you can either:

  • Ask here
  • Create an issue on EsiPy Github
  • Ask me on tweetfleet (@althalus)

(Althalus Stenory) #2

Posting here also, as I made a small breaking change, so more users may see it :wink:

Version 0.2.0

Change :

  • EsiSecurity object no longer require app object to be initialized to get SSO Urls (authorize, token).
    • You can still use it, as before and your app will still work the same as before
    • You can manually give a sso_url instead, to say whether you want SISI / TQ SSO (default is TQ) instead of the app object.
    • If both are given, priority is set to the app object.
  • Use of https://esi.tech.ccp.is/verify/ for verify instead of the sso endpoint (https://login.eveonline.com/oauth/verify)

This introduce a small breaking change if you init EsiSecurity without keyword, since app parameter is no longer the first parameter. You need to:

  • either use keywords to init
  • or put app parameter in the 4th parameter [not recommended]

(Althalus Stenory) #3

Version 0.3.0 - Contains potential breaking changes.

Changes

  • Do not try to cache response if there’s no expires information (#22)
  • Fix cache behavior to be the same everywhere. See details below.
  • Breaking changes :
    • Renamed signal instances to be fully capitalized.
      • after_token_refresh become AFTER_TOKEN_REFRESH
      • api_call_stats become API_CALL_STATS
    • Renamed the following EsiSecurity methods:
      • get_access_token_request_params to become get_access_token_params
      • get_refresh_token_request_params to become get_refresh_token_params

New Feature: EsiApp

EsiApp is an object that will be used to play with ESI Meta Swagger spec.

That mean you will be able to easily get meta endpoints, like /verify, /status the same way as the current App object, but it allows you to also get all current swagger spec used in ESI, for versionned endpoint and others.

Please look at the doc for how to use it.

Caching behavior change

Until now, cache objects worked differently when timeout was equal to 0 or None depending on which engine you used for caching.

To prevent error if switching between engine and to have consistent behavior, if timeout now equals 0 or None, the data will not expire.


(Althalus Stenory) #4

Version 0.4.0 - Etag support !

Cache - Possible breaking change

  • All cache have lost the timeout parameter in set() method.
  • If you have a custom cache with timeout, you should remove it, as it will not allow the Etag process to be used. If you keep it with a default value, it will continue to work.

EsiClient

  • Do not cache POST, PUT and DELETE requests anymore
  • Support for head requests
  • Add Etag mechanism in the cache management
  • Allow to set a raise_on_error flag in EsiClient.request() to get an exception when status is not 2XX.
  • Add a timeout value for requests in the EsiClient.__init__() to force timeout requests (default is None)
  • Allow to define a custom Signal to replace API_CALL_STATS using signal_api_call_stats when initializing the client.

EsiSecurity

  • Allow to define a custom Signal to replace AFTER_TOKEN_REFRESH using signal_token_updated when initializing the client.
  • Add a token identifier that will be returned to the AFTER_TOKEN_REFRESH signal listeners, so it can identify a token

APIException

  • Added request_param and response_header to the Exception, to have more precise data for error management

EsiApp

  • cache_time parameter value has changed. Number and 0 will still behave like before (forcing a cache time or no expiration with 0), None will disable forced cache time and use Expires header from swagger specifications. Default is still 1d caching.
  • While getting swagger spec (meta or any version), EsiApp will make sure to deal correctly with caching (headers Expires and Etag) by doing a HEAD request before (due to how App object works).
  • Add a datasource argument on initialization, to be able to get swagger spec for specific datasource (tranquility by default, or singularity)