API Server

Main module

API Server

class sni.api.server.RouterConfig[source]

Bases: pydantic.main.BaseModel

Basic router configuration

add_to_application(application: fastapi.applications.FastAPI) → None[source]

Adds the current router to the FastAPI application.

include: bool = None
kwargs: dict = None
prefix: str = None
router: str = None
sni.api.server.add_included_routers()[source]

Adds all routers whose include field is True

sni.api.server.print_openapi_spec() → None[source]

Print the OpenAPI specification of the server in YAML.

sni.api.server.setup_sentry() → None[source]

Setup the Sentry middleware.

See also

Sentry homepage <https://sentry.io/welcome/> Sentry documentation for Python ASGI

sni.api.server.start_api_server()[source]

Starts the API server for real. See sni.api.server.start_api_server().

Database models

ESI related database models

class sni.api.models.CrashReport(*args, **values)[source]

Bases: mongoengine.document.Document

Information about a crash, i.e. an uncaught exception that occured during an API request processing. (in fact, the exception is still cought by sni.api.server.exception_handler() as a last resort, and this is where this class is used to save traces to the database).

SCHEMA_VERSION = 1

Latest schema version for this collection

_version

Schema version of this document

request

See sni.api.models.CrashReportRequest

timestamp

When the crash occured. This field is indexed in decreasing order.

to_dict() → dict[source]

Returns a dict representation

token

See sni.api.models.CrashReportToken

trace

Python trace

class sni.api.models.CrashReportRequest(*args, **kwargs)[source]

Bases: mongoengine.document.EmbeddedDocument

Represents a request made to the API.

headers

Headers of the request

method

HTTP method of the request

params

URL parameters of the request

to_dict() → dict[source]

Returns a dict representation

url

URL of the request

class sni.api.models.CrashReportToken(*args, **kwargs)[source]

Bases: mongoengine.document.EmbeddedDocument

Represents a token in a crash report. See sni.uac.models.Token

created_on

See sni.uac.models.Token

expires_on

See sni.uac.models.Token

owner

See sni.uac.models.Token

to_dict() → dict[source]

Returns a dict representation

token_type

See sni.uac.models.Token

uuid

See sni.uac.models.Token

Jobs

Some jobs to he scheduled, regarding the state of the database (e.g. making sure all users are in the good corp, etc.)

Database signals

Database signals. See Mongoengine signals

Migration

Database migrations

sni.api.migration.migrate() → None[source]

Runs migration tasks

Routers

sni.api.routers.alliance

Alliance management paths

class sni.api.routers.alliance.GetAllianceOut[source]

Bases: pydantic.main.BaseModel

Get an alliance data

alliance_id: int = None
alliance_name: str = None
authorized_to_login: Optional[bool] = None
ceo: GetUserShortOut = None
cumulated_mandatory_esi_scopes: List[EsiScope] = None
executor_corporation: GetCorporationShortOut = None
static from_record(alliance: sni.user.models.Alliance) → sni.api.routers.alliance.GetAllianceOut[source]

Converts an instance of sni.user.models.Alliance to sni.api.routers.alliance.GetAllianceOut

mandatory_esi_scopes: List[EsiScope] = None
ticker: str = None
updated_on: datetime = None
class sni.api.routers.alliance.PutAllianceIn[source]

Bases: pydantic.main.BaseModel

Model for PUT /alliance/{alliance_id} requests

authorized_to_login: Optional[bool] = None
mandatory_esi_scopes: Optional[List[EsiScope]] = None
sni.api.routers.alliance.get_alliance(alliance_id: int, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Gets data about an alliance

sni.api.routers.alliance.get_alliance_tracking(alliance_id: int, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Reports which member (of a given alliance) have a valid refresh token attacked to them, and which do not. Requires a clearance level of 3 and having authority over this alliance.

sni.api.routers.alliance.get_alliances(tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Gets the list of alliances registered in this instance. Requires a clearance level of 0 or more.

sni.api.routers.alliance.post_alliance(alliance_id: int, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Manually fetches an alliance from the ESI. Requires a clearance level of 8 or more.

sni.api.routers.alliance.put_alliance(alliance_id: int, data: sni.api.routers.alliance.PutAllianceIn, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Modify an alliance registered on SNI. Note that it does not modify it on an ESI level. Requires a clearance level of 4 or more.

sni.api.routers.callback

Callback paths

async sni.api.routers.callback.get_callback_esi(code: str, state: str)[source]

ESI callback. You should not manually call this.

Upon receiving a notification from EVE SSO, SNI redirects the client to the appropriate frontend callback, with the state code and user token in URL parameters.

Reference:

OAuth 2.0 for Web Based Applications

sni.api.routers.callback.not_authorized_to_login_response(character_name: str, character_id: int) → starlette.responses.HTMLResponse[source]

Returns an HTML response explaing that the user is not allowed to login on this instance.

sni.api.routers.callback.not_enough_scopes_response(character_name: str, character_id: int, required_scopes: List[sni.esi.scope.EsiScope], provided_scopes: List[sni.esi.scope.EsiScope]) → starlette.responses.HTMLResponse[source]

Returns an HTML response explaing that the user did not provide enough ESI scopes.

sni.api.routers.callback.string_list_to_html(string_list: Sequence[str]) → str[source]

Converts a string list to an HTML bullet list.

sni.api.routers.callback.token_manipulation_error_response() → starlette.responses.HTMLResponse[source]

Returns an HTML response explaing that the instance ran in an ESI token manipulation error.

sni.api.routers.coalition

Coalition management paths

Todo

Code is too similar to sni.routers.group

class sni.api.routers.coalition.GetAllianceShortOut[source]

Bases: pydantic.main.BaseModel

Short alliance description

alliance_id: int = None
alliance_name: str = None
static from_record(alliance: sni.user.models.Alliance) → sni.api.routers.coalition.GetAllianceShortOut[source]

Converts an instance of sni.user.models.Alliance to sni.api.routers.alliance.GetAllianceShortOut

class sni.api.routers.coalition.GetCoalitionOut[source]

Bases: pydantic.main.BaseModel

Model for GET /coalition/{coalition_id} responses.

authorized_to_login: Optional[bool] = None
coalition_id: str = None
coalition_name: str = None
created_on: datetime = None
static from_record(coalition: sni.user.models.Coalition) → sni.api.routers.coalition.GetCoalitionOut[source]

Converts a coalition database record to a response.

mandatory_esi_scopes: List[EsiScope] = None
member_alliances: List[GetAllianceShortOut] = None
member_corporations: List[GetCorporationShortOut] = None
ticker: str = None
updated_on: datetime = None
class sni.api.routers.coalition.GetCoalitionShortOut[source]

Bases: pydantic.main.BaseModel

Model for an element of a GET /coalition response.

coalition_id: str = None
coalition_name: str = None
static from_record(coalition: sni.user.models.Coalition) → sni.api.routers.coalition.GetCoalitionShortOut[source]

Converts a coalition database record to a short response.

class sni.api.routers.coalition.PostCoalitionIn[source]

Bases: pydantic.main.BaseModel

Model for POST /coalition responses.

coalition_name: str = None
ticker: str = None
class sni.api.routers.coalition.PutCoalitionIn[source]

Bases: pydantic.main.BaseModel

Model for PUT /coalition/{coalition_id} responses.

add_member_alliances: Optional[List[int]] = None
add_member_corporations: Optional[List[int]] = None
authorized_to_login: Optional[bool] = None
mandatory_esi_scopes: Optional[List[EsiScope]] = None
member_alliances: Optional[List[int]] = None
member_corporations: Optional[List[int]] = None
remove_member_alliances: Optional[List[int]] = None
remove_member_corporations: Optional[List[int]] = None
ticker: Optional[str] = None
sni.api.routers.coalition.delete_coalition(coalition_id: sni.api.routers.common.BSONObjectId, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Deletes a coalition. Requires a clearance level of 9 or more.

sni.api.routers.coalition.get_coalition(tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Lists all the coalition names. Requires a clearance level of 0 or more.

sni.api.routers.coalition.get_coalition_name(coalition_id: sni.api.routers.common.BSONObjectId, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Returns details about a given coalition. Requires a clearance level of 0 or more.

sni.api.routers.coalition.get_coalition_tracking(coalition_id: sni.api.routers.common.BSONObjectId, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Reports which member (of a given coalition) have a valid refresh token attacked to them, and which do not. Requires a clearance level of 5 or more.

sni.api.routers.coalition.post_coalitions(data: sni.api.routers.coalition.PostCoalitionIn, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Creates a coalition. Requires a clearance level of 9 or more.

sni.api.routers.coalition.put_coalition(coalition_id: sni.api.routers.common.BSONObjectId, data: sni.api.routers.coalition.PutCoalitionIn, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Updates a coalition. All fields in the request body are optional. The add_member_alliances and remove_member_alliances fields can be used together, but the member_alliances cannot be used in conjunction with add_member_alliances and remove_member_alliances. Similarly for add_member_corporations, remove_member_corporations, and member_corporations. Requires a clearance level of 6 or more.

sni.api.routers.corporation

Corporation management paths

class sni.api.routers.corporation.GetAllianceShortOut[source]

Bases: pydantic.main.BaseModel

Short alliance description

alliance_id: int = None
alliance_name: str = None
static from_record(alliance: sni.user.models.Alliance) → sni.api.routers.corporation.GetAllianceShortOut[source]

Converts an instance of sni.user.models.Alliance to sni.api.routers.alliance.GetAllianceShortOut

class sni.api.routers.corporation.GetCorporationOut[source]

Bases: pydantic.main.BaseModel

Corporation data

alliance: Optional[GetAllianceShortOut] = None
authorized_to_login: Optional[bool] = None
ceo: GetUserShortOut = None
corporation_id: int = None
corporation_name: str = None
cumulated_mandatory_esi_scopes: List[EsiScope] = None
static from_record(corporation: sni.user.models.Corporation) → sni.api.routers.corporation.GetCorporationOut[source]

Converts an instance of sni.user.models.Corporation to sni.api.routers.corporation.GetCorporationOut

mandatory_esi_scopes: List[EsiScope] = None
ticker: str = None
updated_on: datetime = None
class sni.api.routers.corporation.GetCorporationShortOut[source]

Bases: pydantic.main.BaseModel

Short corporation description

corporation_id: int = None
corporation_name: str = None
static from_record(corporation: sni.user.models.Corporation) → sni.api.routers.corporation.GetCorporationShortOut[source]

Converts an instance of sni.user.models.Corporation to sni.api.routers.corporation.GetCorporationShortOut

class sni.api.routers.corporation.GetTrackingOut[source]

Bases: pydantic.main.BaseModel

Represents a corporation tracking response.

static from_user_iterator(iterator: Iterator[sni.user.models.User]) → sni.api.routers.corporation.GetTrackingOut[source]

Creates a tracking response from a user iterator. See sni.esi.token.tracking_status()

invalid_refresh_token: List[GetUserShortOut] = None
no_refresh_token: List[GetUserShortOut] = None
valid_refresh_token: List[GetUserShortOut] = None
class sni.api.routers.corporation.PostCorporationGuestOut[source]

Bases: pydantic.main.BaseModel

Model for POST /corporation/{corporation_id}/guest reponses.

state_code: str = None
class sni.api.routers.corporation.PutCorporationIn[source]

Bases: pydantic.main.BaseModel

Model for PUT /corporation/{corporation_id} requests

authorized_to_login: Optional[bool] = None
mandatory_esi_scopes: Optional[List[EsiScope]] = None
sni.api.routers.corporation.delete_corporation_guest(corporation_id: int, character_id: int, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Deletes a corporation guest

sni.api.routers.corporation.get_corporation(corporation_id: int, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Get informations about a corporation. Note that this corporation must be registered on SNI

sni.api.routers.corporation.get_corporation_guests(corporation_id: int, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Returns the list of guests in this corporation.

sni.api.routers.corporation.get_corporation_tracking(corporation_id: int, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Reports which member (of a given corporation) have a valid refresh token attacked to them, and which do not. Requires a clearance level of 1 and having authority over this corporation.

sni.api.routers.corporation.get_corporations(tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Gets the list of corporations registered in this instance. Requires a clearance level of 0 or more.

sni.api.routers.corporation.post_corporation(corporation_id: int, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Manually fetches a corporation from the ESI. Requires a clearance level of 8 or more.

sni.api.routers.corporation.post_corporation_guest(corporation_id: int, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Creates a state code for a new guest to this corporation. The user then has to login with this state code to be considered a guest.

sni.api.routers.corporation.put_corporation(corporation_id: int, data: sni.api.routers.corporation.PutCorporationIn, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Modify a corporation registered on SNI. Note that it does not modify it on an ESI level. Requires a clearance level of 2 or more.

sni.api.routers.esi

ESI related paths

class sni.api.routers.esi.EsiRequestIn[source]

Bases: pydantic.main.BaseModel

Data to be forwarded to the ESI

all_pages: bool = None
id_annotations: bool = None
on_behalf_of: Optional[int] = None
params: dict = None
class sni.api.routers.esi.GetCharacterLocationOut[source]

Bases: pydantic.main.BaseModel

Describes a character location

static from_record(location: sni.index.models.EsiCharacterLocation) → sni.api.routers.esi.GetCharacterLocationOut[source]

Converts a sni.index.models.EsiCharacterLocation to a sni.api.routers.esi.GetCharacterLocationOut

online: bool = None
ship_name: str = None
ship_type_id: int = None
ship_type_name: str = None
solar_system_id: int = None
solar_system_name: str = None
station_id: Optional[int] = None
station_name: Optional[str] = None
structure_id: Optional[int] = None
structure_name: Optional[str] = None
timestamp: datetime = None
user: GetUserShortOut = None
class sni.api.routers.esi.GetCharacterMailOut[source]

Bases: pydantic.main.BaseModel

Represents a user email.

class MailRecipient[source]

Bases: pydantic.main.BaseModel

Represents a recipient of the email

static from_record(recipient: sni.index.models.EsiMailRecipient) → sni.api.routers.esi.GetCharacterMailOut.MailRecipient[source]

Converts a sni.index.models.EsiMailRecipient to a sni.api.routers.esi.GetCharacterMailOut.MailRecipient

recipient_id: int = None
recipient_name: str = None
body: str = None
from_id: int = None
from_name: str = None
static from_record(mail: sni.index.models.EsiMail) → sni.api.routers.esi.GetCharacterMailOut[source]

Converts a sni.index.models.EsiMail to a sni.api.routers.esi.GetCharacterMailOut

mail_id: int = None
recipients: List[MailRecipient] = None
subject: str = None
timestamp: datetime = None
class sni.api.routers.esi.GetCharacterMailShortOut[source]

Bases: pydantic.main.BaseModel

Represents a short description (header) of an email

from_character: GetUserShortOut = None
static from_record(mail: sni.index.models.EsiMail) → sni.api.routers.esi.GetCharacterMailShortOut[source]

Converts a sni.index.models.EsiMail to a sni.api.routers.esi.GetCharacterMailShortOut

mail_id: int = None
recipients: List[GetCharacterMailOut.MailRecipient] = None
subject: str = None
timestamp: datetime = None
class sni.api.routers.esi.GetCharacterSkillPointsOut[source]

Bases: pydantic.main.BaseModel

Represents a character’s skill points

static from_record(document: sni.index.models.EsiSkillPoints) → sni.api.routers.esi.GetCharacterSkillPointsOut[source]

Converts a sni.index.models.EsiSkillPoints to a sni.api.routers.esi.GetCharacterSkillPointsOut

timestamp: datetime = None
total_sp: int = None
unallocated_sp: int = None
class sni.api.routers.esi.GetCharacterWalletBalanceOut[source]

Bases: pydantic.main.BaseModel

Represents a character’s wallet balance

balance: float = None
static from_record(balance: sni.index.models.EsiWalletBalance) → sni.api.routers.esi.GetCharacterWalletBalanceOut[source]

Converts a sni.index.models.EsiWalletBalance to a sni.api.routers.esi.GetCharacterWalletBalanceOut

timestamp: datetime = None
async sni.api.routers.esi.get_esi(esi_path: str, data: sni.api.routers.esi.EsiRequestIn = EsiRequestIn(all_pages=False, id_annotations=False, on_behalf_of=None, params={}), tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Forwards a GET request to the ESI. The required clearance level depends on the user making the request and the user specified on the on_behalf_of field. See also EsiRequestIn.

sni.api.routers.esi.get_history_character_location(character_id: int, response: starlette.responses.Response, page: pydantic.types.PositiveInt = Header(1), tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Get the location history of a character. Requires having clearance to access the ESI scopes esi-location.read_location.v1, esi-location.read_online.v1, and esi-location.read_ship_type.v1, of the character. The results are sorted by most to least recent, and paginated by pages of 50 items. The page count in returned in the X-Pages header.

sni.api.routers.esi.get_history_character_mails(character_id: int, response: starlette.responses.Response, page: pydantic.types.PositiveInt = Header(1), tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Get the email history of a character. Requires having clearance to access the ESI scope esi-mail.read_mail.v1 of the character. The results are sorted by most to least recent, and paginated by pages of 50 items. The page count in returned in the X-Pages header.

Todo

Only show email sent by the specified user…

sni.api.routers.esi.get_history_character_skillpoints(character_id: int, response: starlette.responses.Response, page: pydantic.types.PositiveInt = Header(1), tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Get the skill points history of a character. Requires having clearance to access the ESI scope esi-skills.read_skills.v1 of the character. The results are sorted by most to least recent, and paginated by pages of 50 items. The page count in returned in the X-Pages header.

sni.api.routers.esi.get_history_character_wallet(character_id: int, response: starlette.responses.Response, page: pydantic.types.PositiveInt = Header(1), tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Get the wallet balance history of a character. Requires having clearance to access the ESI scope esi-wallet.read_character_wallet.v1 of the character. The results are sorted by most to least recent, and paginated by pages of 50 items. The page count in returned in the X-Pages header.

sni.api.routers.esi.post_history_character_location_now(character_id: int, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Get and save the current location of a character. Requires having clearance to access the ESI scopes esi-location.read_location.v1, esi-location.read_online.v1, and esi-location.read_ship_type.v1, of the character.

sni.api.routers.group

Group management paths

class sni.api.routers.group.GetGroupOut[source]

Bases: pydantic.main.BaseModel

Model for GET /group/{group_id} responses.

authorized_to_login: Optional[bool] = None
created_on: datetime = None
description: str = None
static from_record(grp: sni.user.models.Group) → sni.api.routers.group.GetGroupOut[source]

Converts a group database record to a response.

group_id: str = None
group_name: str = None
is_autogroup: bool = None
members: List[GetUserShortOut] = None
owner: Optional[GetUserShortOut] = None
updated_on: datetime = None
class sni.api.routers.group.GetGroupShortOut[source]

Bases: pydantic.main.BaseModel

Model for an element of GET /group responses

group_id: str = None
group_name: str = None
class sni.api.routers.group.PostGroupIn[source]

Bases: pydantic.main.BaseModel

Model for POST /group responses.

description: str = None
group_name: str = None
class sni.api.routers.group.PutGroupIn[source]

Bases: pydantic.main.BaseModel

Model for POST /group responses.

add_members: Optional[List[str]] = None
authorized_to_login: Optional[bool] = None
description: Optional[str] = None
members: Optional[List[str]] = None
owner: Optional[str] = None
remove_members: Optional[List[str]] = None
sni.api.routers.group.delete_group(group_id: sni.api.routers.common.BSONObjectId, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Deletes a group. Requires a clearance level of 9 or more.

sni.api.routers.group.get_group(tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Lists all the group names. Requires a clearance level of 0 or more.

sni.api.routers.group.get_group_name(group_id: sni.api.routers.common.BSONObjectId, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Returns details about a given group. Requires a clearance level of 0 or more.

sni.api.routers.group.post_groups(data: sni.api.routers.group.PostGroupIn, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Creates a group. Requires a clearance level of 9 or more.

sni.api.routers.group.put_group(group_id: sni.api.routers.common.BSONObjectId, data: sni.api.routers.group.PutGroupIn, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Updates a group. All fields in the request body are optional. The add_members and remove_members fields can be used together, but the members cannot be used in conjunction with add_members and remove_members. Requires a clearance level of 9 or more of for the user to be the owner of the group.

sni.api.routers.system

SNI instance administrative paths

class sni.api.routers.system.GetJobOut[source]

Bases: pydantic.main.BaseModel

Represents a job

coalesce: bool = None
executor: str = None
static from_job(job: apscheduler.job.Job) → sni.api.routers.system.GetJobOut[source]

Converts a apscheduler.job.Job to a sni.api.routers.system.GetJobOut.

function: str = None
job_id: str = None
max_instances: Optional[int] = None
misfire_grace_time: Optional[int] = None
name: str = None
next_run_time: Optional[datetime] = None
trigger: Optional[str] = None
sni.api.routers.system.get_configuration(tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Gets the configuration of the SNI instance. Secrets are redacted. Requires a clearance of 10.

sni.api.routers.system.get_jobs(tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Gets the currently scheduled job list. Requires a clearance level of 10.

sni.api.routers.system.post_job(callable_name: str, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Submits a job to the scheduler. Requires a clearance level of 10.

sni.api.routers.teamspeak

Teamspeak related paths

class sni.api.routers.teamspeak.PostAuthStartOut[source]

Bases: pydantic.main.BaseModel

Model for POST /teamspeak/auth/start responses.

challenge_nickname: str = None
expiration_datetime: datetime = None
user: GetUserShortOut = None
sni.api.routers.teamspeak.port_auth_start(tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Starts a new authentication challenge for the owner of the token. A random nickname is returned (see PostAuthStartOut for more details), and the user has 1 minute to update its teamspeak nickname to it, and then call POST /teamspeak/auth/complete.

sni.api.routers.teamspeak.post_auth_complete(tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Completes an authentication challenge for the owner of the token. See the POST /teamspeak/auth/start documentation.

sni.api.routers.token

Token management paths

class sni.api.routers.token.GetTokenOut[source]

Bases: pydantic.main.BaseModel

Model for GET /token responses.

callback: Optional[pdt.AnyHttpUrl] = None
comments: Optional[str] = None
created_on: datetime = None
expires_on: Optional[datetime] = None
static from_record(tkn: sni.uac.models.Token) → sni.api.routers.token.GetTokenOut[source]

Converts a sni.uac.models.Token to a sni.api.routers.token.GetTokenOut

owner: GetUserOut = None
parent: Optional[str] = None
token_type: Token.TokenType = None
uuid: str = None
class sni.api.routers.token.PostTokenDynIn[source]

Bases: pydantic.main.BaseModel

Model for POST /token/dyn requests.

callback: pdt.AnyHttpUrl = None
comments: Optional[str] = None
class sni.api.routers.token.PostTokenDynOut[source]

Bases: pydantic.main.BaseModel

Model for POST /token/dyn reponses.

tkn: str = None
class sni.api.routers.token.PostTokenPerIn[source]

Bases: pydantic.main.BaseModel

Model for POST /token/per requests.

callback: pdt.AnyHttpUrl = None
comments: Optional[str] = None
class sni.api.routers.token.PostTokenPerOut[source]

Bases: pydantic.main.BaseModel

Model for POST /token/per reponses.

tkn: str = None
class sni.api.routers.token.PostTokenUseFromDynIn[source]

Bases: pydantic.main.BaseModel

Model for POST /token/use/from/dyn requests.

scopes: List[EsiScope] = None
state_code: Optional[str] = None
class sni.api.routers.token.PostTokenUseFromDynOut[source]

Bases: pydantic.main.BaseModel

Model for POST /token/use/from/dyn reponses.

login_url: str = None
state_code: str = None
class sni.api.routers.token.PostUseFromPerOut[source]

Bases: pydantic.main.BaseModel

Model for POST /token/use/from/per reponses.

user_token: str = None
async sni.api.routers.token.delete_token(uuid: pydantic.types.UUID4, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Manually deletes a token (of any type). Requires a clearance level of 10.

async sni.api.routers.token.get_token(tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Returns informations about the token currently being used. Requires a clearance level of 0 or more.

async sni.api.routers.token.post_token_dyn(data: sni.api.routers.token.PostTokenDynIn, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Creates a new dynamic app token. Must be called with a permanent app token, and the owner must have a clearance level of 10.

async sni.api.routers.token.post_token_per(data: sni.api.routers.token.PostTokenPerIn, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Creates a new permanent app token. Must be called with a permanent app token, and the owner must have a clearance level of 10.

async sni.api.routers.token.post_token_use_from_dyn(data: sni.api.routers.token.PostTokenUseFromDynIn, tkn: sni.uac.models.Token = Depends(from_authotization_header))[source]

Authenticates an application dynamic token and returns a state code and an URL at which the user can authenticate to the EVE SSO. Once that is done, SNI issues a GET request to the app predefined callback, with that state code and the user token. Requires the owner of the token to have a clearance level of 0 or more.

async sni.api.routers.token.post_token_use_from_per(tkn: sni.uac.models.Token = Depends(from_authotization_header))[source]

Authenticates an application permanent token and returns a user token tied to the owner of that app token.

sni.api.routers.user

User management paths

class sni.api.routers.user.GetUserOut[source]

Bases: pydantic.main.BaseModel

Model for GET /user/{character_name} responses

alliance: Optional[int] = None
authorized_to_login: Optional[bool] = None
available_esi_scopes: List[EsiScope] = None
character_id: int = None
character_name: str = None
clearance_level: int = None
coalitions: List[str] = None
corporation: Optional[str] = None
created_on: datetime = None
cumulated_mandatory_esi_scopes: List[EsiScope] = None
static from_record(usr: sni.user.models.User) → sni.api.routers.user.GetUserOut[source]

Populates a new sni.routers.user.GetUserOut with the information contained in a user database record.

is_ceo_of_alliance: bool = None
is_ceo_of_corporation: bool = None
tickered_name: str = None
updated_on: datetime = None
class sni.api.routers.user.GetUserShortOut[source]

Bases: pydantic.main.BaseModel

Model for an element of GET /user response

character_id: int = None
character_name: str = None
static from_record(usr: sni.user.models.User) → sni.api.routers.user.GetUserShortOut[source]

Converts a sni.user.models.User to a sni.api.routers.user.GetUserShortOut

class sni.api.routers.user.PutUserIn[source]

Bases: pydantic.main.BaseModel

Model for PUT /user/{character_id} requests

authorized_to_login: Optional[bool] = None
clearance_level: Optional[int] = None
sni.api.routers.user.delete_user(character_id: int, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Deletes a user. Requires a clearance level of 9 or more.

sni.api.routers.user.get_user(tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Returns the list of all user names. Requires a clearance level of 0 or more.

sni.api.routers.user.get_user_name(character_id: int, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Returns details about a character. Requires a clearance level of 0 or more.

sni.api.routers.user.put_user_name(character_id: int, data: sni.api.routers.user.PutUserIn, tkn: sni.uac.models.Token = Depends(from_authotization_header_nondyn))[source]

Manually updates non ESI data about a character. The required clearance level depends on the modification.