api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
Project description
api.video's Python API client streamlines the coding process. Chunking files is handled for you, as is pagination and refreshing your tokens.
Getting started
Requirements
Python >= 3.6
Installation
pip install api.video
Code samples
Automatic authentication
list all videos:
import apivideofrom apivideo.apis import VideosApiapi_key = "__API_KEY__"with apivideo.AuthenticatedApiClient(api_key) as client: # if you rather like to use the sandbox environment: # with apivideo.AuthenticatedApiClient(api_key, production=False) as client: videos_api = VideosApi(client) videos = videos_api.list()
In this context the client will keep its authentication updated.
Manual authentication
If there is an issue, like you think a refresh token may have been exposed, you can manually retrieve a new one. Otherwise, authentication is handled for you.
When you retrieve a new refresh token, the old one becomes invalid. Here is the code, where you retrieve a list of videos and then refresh your token:
import apivideofrom apivideo.apis import VideosApifrom apivideo.exceptions import ApiAuthExceptionapi_key = "__API_KEY__"client = apivideo.AuthenticatedApiClient(api_key)# if you rather like to use the sandbox environment:# client = apivideo.AuthenticatedApiClient(api_key, production=False)client.connect()videos_api = VideosApi(client)videos = videos_api.list()try: client.refresh_token()except ApiAuthException: print("cannot refresh token !")...
Please take a moment to leave a star on the client
This helps other users to find the clients and also helps us understand which clients are most popular. Thank you!
Contribution
Since this API client is generated from an OpenAPI description, we cannot accept pull requests made directly to the repository. If you want to contribute, you can open a pull request on the repository of our client generator. Otherwise, you can also simply open an issue detailing your need on this repository.