Skip to content

auth

Module for encapsulating Geo Engine authentication

class BearerAuth(AuthBase)

A bearer token authentication for requests

class Session()

A Geo Engine session

def __init__(server_url: str,
credentials: tuple[str, str] | None = None,
token: str | None = None) -> None

Initialize communication between this library and a Geo Engine instance

If credentials or a token are provided, the session will be authenticated. Credentials and token must not be provided at the same time.

optional arguments:

  • (email, password) as tuple
  • token as a string

optional environment variables:

  • GEOENGINE_EMAIL
  • GEOENGINE_PASSWORD
  • GEOENGINE_TOKEN
def __repr__() -> str

Display representation of a session

@property
def auth_header() -> dict[str, str]

Create an authentication header for the current session

@property
def server_url() -> str

Return the server url of the current session

@property
def configuration() -> geoengine_api_client.Configuration

Return the current http configuration

@property
def user_id() -> UUID

Return the user id. Only works in Geo Engine Pro.

def requests_bearer_auth() -> BearerAuth

Return a Bearer authentication object for the current session

def logout()

Logout the current session

def get_session() -> Session

Return the global session if it exists

Raises an exception otherwise.

def initialize(server_url: str,
credentials: tuple[str, str] | None = None,
token: str | None = None) -> None

Initialize communication between this library and a Geo Engine instance

If credentials or a token are provided, the session will be authenticated. Credentials and token must not be provided at the same time.

optional arugments: (email, password) as tuple or token as a string optional environment variables: GEOENGINE_EMAIL, GEOENGINE_PASSWORD, GEOENGINE_TOKEN optional .env file defining: GEOENGINE_EMAIL, GEOENGINE_PASSWORD, GEOENGINE_TOKEN

def reset(logout: bool = True) -> None

Resets the current session