https://github.com/epilot-dev/sdk-python
Python SDK for Epilot APIs
https://github.com/epilot-dev/sdk-python
api energy energy-platform energy-transition python sdk sdk-python
Last synced: 5 months ago
JSON representation
Python SDK for Epilot APIs
- Host: GitHub
- URL: https://github.com/epilot-dev/sdk-python
- Owner: epilot-dev
- License: apache-2.0
- Created: 2023-02-02T23:58:32.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T00:20:08.000Z (about 2 years ago)
- Last Synced: 2024-04-13T23:15:43.119Z (about 2 years ago)
- Topics: api, energy, energy-platform, energy-transition, python, sdk, sdk-python
- Language: Python
- Homepage: https://docs.epilot.io/docs/intro/
- Size: 5.43 MB
- Stars: 3
- Watchers: 7
- Forks: 0
- Open Issues: 37
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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](https://docs.epilot.io/docs/intro/) 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:
```bash
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.
```bash
Authorization: Bearer
```
### 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.
```bash
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.
```bash
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.
```bash
// 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
```bash
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.
```python
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](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)