Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
suhailkakar committed Nov 14, 2023
0 parents commit 7d1a10e
Show file tree
Hide file tree
Showing 353 changed files with 12,149 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This allows generated code to be indexed correctly
*.py linguist-generated=false
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
venv/
src/*.egg-info/
__pycache__/
.pytest_cache/
.python-version
.DS_Store
144 changes: 144 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Livepeer Python Library

The Livepeer Python library provides convenient access to the Livepeer Studio API from
applications written in Python

## Documentation

For full documentation and examples, please visit [docs.livepeer.org](https://docs.livepeer.org/sdks/javascript/).

## Installation

Install the package:

```bash
pip install livepeer
```

## Usage

The library needs to be configured with your Livepeer Studio account's API key, which is available in the [Studio Dashboard](httpss://livepeer.studio)

```python
import livepeer
from livepeer.models import operations

lpClient = livepeer.SDK(
api_key="",
)


res = lpClient.stream.get_all()

if res.data is not None:
# handle response
pass
```

## Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:

```python
import livepeer
from livepeer.models import operations

lpClient = livepeer.SDK(
server_url="https://livepeer.studio/api",
api_key="",
)


res = lpClient.stream.get_all()

if res.data is not None:
# handle response
pass
```

## Custom HTTP Client

The Python SDK makes API calls using the (requests)[https://pypi.org/project/requests/] HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom `requests.Session` object.

For example, you could specify a header for every request that this sdk makes as follows:

```python
import livepeer
import requests

http_client = requests.Session()
http_client.headers.update({'x-custom-header': 'someValue'})
lpClient = livepeer.SDK(client: http_client)
```

## Available Resources and Operations

### [stream](docs/sdks/stream/README.md)

- [get_all](docs/sdks/stream/README.md#get_all) - Retrieve streams
- [create](docs/sdks/stream/README.md#create) - Create a stream
- [delete](docs/sdks/stream/README.md#delete) - Delete a stream
- [get](docs/sdks/stream/README.md#get) - Retrieve a stream
- [update](docs/sdks/stream/README.md#update) - Update a stream
- [create_clip](docs/sdks/stream/README.md#create_clip) - Create a clip
- [get_all_clips](docs/sdks/stream/README.md#get_all_clips) - Retrieve clips of a livestream

### [multistream_target](docs/sdks/multistreamtarget/README.md)

- [get_all](docs/sdks/multistreamtarget/README.md#get_all) - Retrieve Multistream Targets
- [create](docs/sdks/multistreamtarget/README.md#create) - Create a multistream target
- [delete](docs/sdks/multistreamtarget/README.md#delete) - Delete a multistream target
- [get](docs/sdks/multistreamtarget/README.md#get) - Retrieve a multistream target
- [update](docs/sdks/multistreamtarget/README.md#update) - Update Multistream Target

### [webhook](docs/sdks/webhook/README.md)

- [get_all](docs/sdks/webhook/README.md#get_all) - Retrieve a Webhook
- [create](docs/sdks/webhook/README.md#create) - Create a webhook
- [delete](docs/sdks/webhook/README.md#delete) - Delete a webhook
- [get](docs/sdks/webhook/README.md#get) - Retrieve a webhook
- [update](docs/sdks/webhook/README.md#update) - Update a webhook

### [asset](docs/sdks/asset/README.md)

- [get_all](docs/sdks/asset/README.md#get_all) - Retrieve assets
- [create](docs/sdks/asset/README.md#create) - Upload an asset
- [create_via_url](docs/sdks/asset/README.md#create_via_url) - Upload asset via URL
- [delete](docs/sdks/asset/README.md#delete) - Delete an asset
- [get](docs/sdks/asset/README.md#get) - Retrieves an asset
- [update](docs/sdks/asset/README.md#update) - Update an asset

### [metrics](docs/sdks/metrics/README.md)

- [get_viewership](docs/sdks/metrics/README.md#get_viewership) - Query viewership metrics
- [get_creator_viewership](docs/sdks/metrics/README.md#get_creator_viewership) - Query creator viewership metrics
- [get_public_total_views](docs/sdks/metrics/README.md#get_public_total_views) - Query public total views metrics
- [get_usage](docs/sdks/metrics/README.md#get_usage) - Query usage metrics

### [session](docs/sdks/session/README.md)

- [get_all](docs/sdks/session/README.md#get_all) - Retrieve sessions
- [get](docs/sdks/session/README.md#get) - Retrieve a session
- [get_recorded](docs/sdks/session/README.md#get_recorded) - Retrieve Recorded Sessions
- [get_all_clips](docs/sdks/session/README.md#get_all_clips) - Retrieve clips of a session

### [access_control](docs/sdks/accesscontrol/README.md)

- [get_signing_keys](docs/sdks/accesscontrol/README.md#get_signing_keys) - Retrieves signing keys
- [create_signing_key](docs/sdks/accesscontrol/README.md#create_signing_key) - Create a signing key
- [delete_signing_key](docs/sdks/accesscontrol/README.md#delete_signing_key) - Delete Signing Key
- [get_signing_key](docs/sdks/accesscontrol/README.md#get_signing_key) - Retrieves a signing key
- [update_signing_key](docs/sdks/accesscontrol/README.md#update_signing_key) - Update a signing key

### [task](docs/sdks/task/README.md)

- [get_all](docs/sdks/task/README.md#get_all) - Retrieve Tasks
- [get](docs/sdks/task/README.md#get) - Retrieve a Task

### [transcode](docs/sdks/transcode/README.md)

- [create](docs/sdks/transcode/README.md#create) - Transcode a video

### [playback](docs/sdks/playback/README.md)

- [get](docs/sdks/playback/README.md#get) - Retrieve Playback Info
22 changes: 22 additions & 0 deletions docs/models/components/asset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Asset


## Fields

| Field | Type | Required | Description | Example |
| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `id` | *str* | :heavy_check_mark: | N/A | 09F8B46C-61A0-4254-9875-F71F4C605BC7 |
| `type` | [Optional[components.AssetType]](../../models/components/assettype.md) | :heavy_minus_sign: | Type of the asset. | video |
| `playback_id` | *Optional[str]* | :heavy_minus_sign: | Used to form playback URL and storage folder | eaw4nk06ts2d0mzb |
| `playback_url` | *Optional[str]* | :heavy_minus_sign: | URL for HLS playback | https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8 |
| `download_url` | *Optional[str]* | :heavy_minus_sign: | URL to manually download the asset if desired | https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video |
| `playback_policy` | [Optional[components.PlaybackPolicy]](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for a asset or stream is public or signed | |
| `source` | [Union[components.Asset1Output, components.Two, components.Asset3]](../../models/components/assetsource.md) | :heavy_check_mark: | N/A | [object Object] |
| `creator_id` | [Optional[Union[components.CreatorID1]]](../../models/components/creatorid.md) | :heavy_minus_sign: | N/A | |
| `storage` | [Optional[components.AssetStorage]](../../models/components/assetstorage.md) | :heavy_minus_sign: | N/A | |
| `status` | [Optional[components.AssetStatus]](../../models/components/assetstatus.md) | :heavy_minus_sign: | Status of the asset | |
| `name` | *str* | :heavy_check_mark: | Name of the asset. This is not necessarily the filename, can be a<br/>custom name or title<br/> | filename.mp4 |
| `created_at` | *Optional[float]* | :heavy_minus_sign: | Timestamp (in milliseconds) at which asset was created | 1587667174725 |
| `size` | *Optional[float]* | :heavy_minus_sign: | Size of the asset in bytes | 84934509 |
| `hash` | List[[components.Hash](../../models/components/hash.md)] | :heavy_minus_sign: | Hash of the asset | [object Object] |
| `video_spec` | [Optional[components.VideoSpec]](../../models/components/videospec.md) | :heavy_minus_sign: | Video metadata | |
11 changes: 11 additions & 0 deletions docs/models/components/asset1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Asset1


## Fields

| Field | Type | Required | Description |
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| `type` | [components.AssetSchemasType](../../models/components/assetschemastype.md) | :heavy_check_mark: | N/A |
| `url` | *str* | :heavy_check_mark: | URL from which the asset was uploaded |
| `gateway_url` | *Optional[str]* | :heavy_minus_sign: | Gateway URL from asset if parsed from provided URL on upload. |
| `encryption` | [Optional[components.Encryption]](../../models/components/encryption.md) | :heavy_minus_sign: | N/A |
11 changes: 11 additions & 0 deletions docs/models/components/asset1output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Asset1Output


## Fields

| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
| `type` | [components.AssetSchemasType](../../models/components/assetschemastype.md) | :heavy_check_mark: | N/A |
| `url` | *str* | :heavy_check_mark: | URL from which the asset was uploaded |
| `gateway_url` | *Optional[str]* | :heavy_minus_sign: | Gateway URL from asset if parsed from provided URL on upload. |
| `encryption` | [Optional[components.EncryptionOutput]](../../models/components/encryptionoutput.md) | :heavy_minus_sign: | N/A |
Loading

0 comments on commit 7d1a10e

Please sign in to comment.