Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/speakeasy-sdks/hex-python-sdk

Hex Python SDK
https://github.com/speakeasy-sdks/hex-python-sdk

analytics api data python sdk

Last synced: 2 days ago
JSON representation

Hex Python SDK

Awesome Lists containing this project

README

        

# Hex Python SDK


Programmatically run projects with the Hex API.




## SDK Installation

```bash
pip install hex
```

## Authentication

API Requests are authenticated using Oauth 2.0 Bearer Tokens in the header of the HTTP request. The token is always bound to a single Hex user's account and requests are executed as that Hex user, meaning the user can only execute requests against projects that are in line with the current permissions for that project.

### Token creation

![](https://learn.hex.tech/assets/images/api-tokens-3e39d4aea5ed40b3aeff4d583c80a41d.png)

Personal access tokens can be created from the API keys section of the User settings page.

A new token can be created by selecting the New Token button, then inputting a description and an expiration time frame. An existing token can be regenerated at any time by selecting the three-dot menu to the right of the token, and selecting Regenerate.

## SDK Example Usage

```python
import hex
from hex.models import operations, shared

s = hex.Hex()
s.config_security(
security=shared.Security(
bearer_auth=shared.SchemeBearerAuth(
authorization="Bearer YOUR_BEARER_TOKEN_HERE",
),
)
)

req = operations.CancelRunRequest(
path_params=operations.CancelRunPathParams(
project_id="unde",
run_id="deserunt",
),
)

res = s.cancel_run(req)

if res.status_code == 200:
# handle response
```

## SDK Available Operations

### Hex SDK

* `cancel_run` - Cancel a project run.
* `get_project_runs` - Get the status of the API-triggered runs of a project.
* `get_run_status` - Get the status of a project run.
* `run_project` - Trigger a run of the latest published version of a project.

### SDK Generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)