Oringally an SSO for ESI exampple with Quart.
Now multi-corp structure fuel / extraction tracking.
Eve Online ESI login example using Quart (asyncio implementation of the Flask api).
Requires a valid application setup.
- Python 3.11
- Redis / Redict for session state
- Postgres for backing store
- Some form of reverse proxy / tls termination. I used nginx. Reverse proxy must set
X-Forwarded-For/X-Forwarded-Protoheaders.
This example uses Quart-Session which requires a working backend. I used Redis with a default configuration (listening on localhost).
python3.11 -m venv --upgrade-deps python3.11-env
. python3.11-env/bin/activate
pip install -r requirements.txtCreate an ESI Application at developers.eveonline.com.
The application uses the following scopes:
-
As a User:
publicData
-
As a Contributor (to provide structure / extraction data):
publicDataesi-characters.read_corporation_roles.v1esi-corporations.read_structures.v1esi-industry.read_corporation_mining.v1
Set environent variable for the ClientID:
export ESI_CLIENT_ID='<client_id_from_developers_eveonline_com'Should work with a suitable SQLAlchemy engine URL. I use:
export ESI_SQLALCHEMY_DB_URL='postgresql+asyncpg://username:password@hostname/database'Setting this up on a local machine was approximately:
createuser --pwprompt username
createdb --encoding=UTF8 --owner=username databaseThis example includes a very basic permissions system. Alliances / Corporations / Characters can be included / excluded. The intent is to be similar / familiar to the way in-game ACLs behave.
Permission is evaluated by checking Alliance then Corporation then Character id against the permission list. Check AppFunctions.is_permitted for the details.
You will want to adjust either the defaults in tasks/app_access_control_tasks.py, at a minimum to permit your Character(s) and/or exclude the Alliances and Corporations in my defaults.
This example can be optionally configured to send telemetry to honeycomb.io.
Check the OpenTelemetry for Python link for an introduction.
For telemetry to be transmitted, install the packages from requirements.txt and set the environment variables for your team:
export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.honeycomb.io/"
export OTEL_EXPORTER_OTLP_HEADERS="x-honeycomb-team=your-api-key"
export OTEL_SERVICE_NAME="your-service-name"At startup the example will pull universe data from ESI.
This can be slow, especially on the first startup, when the database is empty.
Structure information will not populate until this universe data is collected (because of the ORM relationships that are defined between structures and systems and moons).
There are small "tasks" - coroutines - (via asyncio.create_task() for collecting universe and structure data, and for periodically refreshing jwt keys and access_tokens for users.
-- Jay Blunt
© 2022 Jay Blunt. All rights reserved.
All EVE related materials © 2014 CCP hf. All rights reserved.
"EVE", "EVE Online", "CCP", and all related logos and images are trademarks or registered trademarks of CCP hf.