Python client for the RIXL API.
Project description
rixl-python
Python client for the RIXL API.
Install
pip install rixl-python
Requires Python 3.10+. microsoft-kiota-bundle is pulled in transitively (HTTP transport, serializers, request adapter).
Quick start
import asyncio
from kiota_abstractions.authentication.api_key_authentication_provider import (
ApiKeyAuthenticationProvider, KeyLocation,
)
from kiota_http.httpx_request_adapter import HttpxRequestAdapter
from rixl_client import RixlClient
async def main():
auth = ApiKeyAuthenticationProvider(
api_key="YOUR_RIXL_API_KEY",
parameter_name="X-API-Key",
key_location=KeyLocation.Header,
)
adapter = HttpxRequestAdapter(auth)
client = RixlClient(adapter)
image = await client.images.by_image_id("PS5IMKoFLm").get()
print(image.id, image.width, image.height)
asyncio.run(main())
Default base URL: https://api.rixl.com. Override with adapter.base_url = "...".
Authentication
API key:
from kiota_abstractions.authentication.api_key_authentication_provider import (
ApiKeyAuthenticationProvider, KeyLocation,
)
auth = ApiKeyAuthenticationProvider(
"YOUR_RIXL_API_KEY", "X-API-Key", KeyLocation.Header,
)
Bearer token: implement AccessTokenProvider, then wrap with BaseBearerTokenAuthenticationProvider from kiota_abstractions.authentication.base_bearer_token_authentication_provider.
Feeds
posts = await client.feeds.by_feed_id("FD4y3QB38S").get()
for post in posts.data:
print(post.id)
Images
page = await client.images.get()
image = await client.images.by_image_id("PS5IMKoFLm").get()
await client.images.by_image_id("PS5IMKoFLm").delete()
Upload (init → PUT bytes → complete):
import httpx
from models.internal_images_handler.upload_init_request import UploadInitRequest
from models.internal_images_handler.complete_request import CompleteRequest
init_req = UploadInitRequest()
init_req.name = "photo.jpg"
init_req.format = "jpeg"
init_res = await client.images.upload.init.post(init_req)
async with httpx.AsyncClient() as c:
await c.put(init_res.presigned_url, content=image_bytes,
headers={"Content-Type": "image/jpeg"})
complete_req = CompleteRequest()
complete_req.image_id = init_res.image_id
complete_req.attached_to_video = False
image = await client.images.upload.complete.post(complete_req)
Videos
videos = await client.videos.get()
video = await client.videos.by_video_id("VI9VXQxWXQ").get()
tracks = await client.videos.by_video_id("VI9VXQxWXQ").subtitles.get()
Upload returns presigned URLs for both the video and a poster image:
from models.video_upload_init_request import VideoUploadInitRequest
from models.github_com_rixlhq_api_internal_videos_handler_upload.complete_request \
import CompleteRequest as VideoCompleteRequest
init_req = VideoUploadInitRequest()
init_req.file_name = "clip.mp4"
init_req.image_format = "jpeg"
init_res = await client.videos.upload.init.post(init_req)
# PUT bytes to init_res.video_presigned_url and init_res.poster_presigned_url
complete_req = VideoCompleteRequest()
complete_req.video_id = init_res.video_id
video = await client.videos.upload.complete.post(complete_req)
Pagination
List endpoints take limit, offset, sort, order:
from kiota_abstractions.base_request_configuration import RequestConfiguration
from rixl_sdk.images.images_request_builder import ImagesRequestBuilder
limit, offset = 50, 0
while True:
params = ImagesRequestBuilder.ImagesRequestBuilderGetQueryParameters(
limit=limit, offset=offset,
)
page = await client.images.get(
request_configuration=RequestConfiguration(query_parameters=params),
)
if offset + len(page.data) >= page.pagination.total:
break
offset += limit
Errors
from rixl_sdk.models.github_com_rixlhq_api_internal_errors.error_response import ErrorResponse
try:
image = await client.images.by_image_id("PS5IMKoFLm").get()
except ErrorResponse as e:
print(f"HTTP {e.code}: {e.error}")
Network failures raise httpx exceptions.
Examples
Runnable demos in examples/:
cd examples
pip install -r requirements.txt
export RIXL_API_KEY=<key>
python basic/images/main.py
python advanced/videos/main.py
Issues
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rixl_python-0.2.2.tar.gz.
File metadata
- Download URL: rixl_python-0.2.2.tar.gz
- Upload date:
- Size: 22.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b9c73df78c50120de5181839c54735e03822fc4f9b63e49dc7007b2fc63a5b9
|
|
| MD5 |
40c0b048d0eabf2555dd7bdd7226151d
|
|
| BLAKE2b-256 |
845bf0403fb93aaab1e4a8b3a97d240754cc5242329047a5746d93c19756d698
|
Provenance
The following attestation bundles were made for rixl_python-0.2.2.tar.gz:
Publisher:
release.yml on rixlhq/rixl-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rixl_python-0.2.2.tar.gz -
Subject digest:
6b9c73df78c50120de5181839c54735e03822fc4f9b63e49dc7007b2fc63a5b9 - Sigstore transparency entry: 1409485316
- Sigstore integration time:
-
Permalink:
rixlhq/rixl-python@91231df12a684378b70cce5447eab631847ca330 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/rixlhq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@91231df12a684378b70cce5447eab631847ca330 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rixl_python-0.2.2-py3-none-any.whl.
File metadata
- Download URL: rixl_python-0.2.2-py3-none-any.whl
- Upload date:
- Size: 68.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7381e556220be89694f7910f4a0387168a05877747351c4ceffcc1d9d6022e5
|
|
| MD5 |
f447a029acd4a917d85fc731e4ef50d3
|
|
| BLAKE2b-256 |
6e63688f5ceaf983059aa91167d28cae815fb518c180bca6847eaa2c2fc02710
|
Provenance
The following attestation bundles were made for rixl_python-0.2.2-py3-none-any.whl:
Publisher:
release.yml on rixlhq/rixl-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rixl_python-0.2.2-py3-none-any.whl -
Subject digest:
a7381e556220be89694f7910f4a0387168a05877747351c4ceffcc1d9d6022e5 - Sigstore transparency entry: 1409485332
- Sigstore integration time:
-
Permalink:
rixlhq/rixl-python@91231df12a684378b70cce5447eab631847ca330 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/rixlhq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@91231df12a684378b70cce5447eab631847ca330 -
Trigger Event:
push
-
Statement type: