Skip to content

epilot-dev/sdk-python

Repository files navigation

Epilot is the digital foundation for sales, service, network and implementation processes in the context of the energy transition..

This is a monorepo of Python SDKs for the Epilot APIs. Please see the Epilot developer documentation for more information. Each SDK is an independent package with the folder name representing the API.

SDK Installation

SDKs for each API are independently versioned and tagged enabling a per API installation. For example the sdk for the Automation API can be installed as follows:

pip install epilot-automation

Authentication

To call epilot APIs, requests must be authorized using a valid Access Token.

Using Access Token Authorization

The access token should be passed in the Authorization request header.

Authorization: Bearer <your-access-token>

Creating Access Tokens

Users logged into the epilot 360 portal can manage their Access Tokens from Settings > Access Tokens.

Creating access tokens requires the token:create permission.

Access Token API Authenticated users can generate long-term access tokens for 3rd party applications using the epilot Access Token API createAccessToken operation.

POST /v1/access-tokens
{
  "name": "Token for my application"
}

Optionally, you can pass a list of Role IDs, to define the roles the access token will have access to. By default, the access token inherits the caller's roles.

POST /v1/access-tokens
{
  "name": "Postman Access Token",
  "assume_roles": ["123:owner"]
}

Each Access Token generated via the API gets a generated a unique ID.

// 201 - success
{
  "id": "api_5ZugdRXasLfWBypHi93Fk",
  "created_at": "2019-08-24T14:15:22Z",
  "name": "Postman Access Token",
  "assignments": ["123:owner"]
}

Access tokens may also be revoked using the revokeAccessToken operation

DELETE /v1/access-tokens/api_5ZugdRXasLfWBypHi93Fk
// 200 - success
{
  "id": "api_5ZugdRXasLfWBypHi93Fk",
  "created_at": "2019-08-24T14:15:22Z",
  "name": "Postman Access Token",
  "assignments": ["123:owner"]
}

SDK Example Usage

Here is an example of using the SDK. Please refer to each sub SDK folder for usage examples specific to an API.

import epilot
from epilot.models import operations, shared

s = epilot.Epilot(
    security=shared.Security(
        epilot_auth="Bearer YOUR_BEARER_TOKEN_HERE",
    ),
)


req = operations.CancelExecutionRequest(
    execution_id="9baf184f-bc81-4128-bca3-d974c90a12c4",
)
    
res = s.executions.cancel_execution(req)

if res.automation_execution is not None:
    # handle response

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release !

SDK Created by Speakeasy