Python API client

Python API client for api.video service (beta version)

api.video Python api client

api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes.

Warning

This API client is still in beta. Please feel free to report any issue you may encounter.

Requirements.

Python >= 3.6

Installation

pip install api.video

Examples

Automatic authentication

list all videos:

import apivideo
from apivideo.apis import VideosApi

api_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 apivideo
from apivideo.apis import VideosApi
from apivideo.exceptions import ApiAuthException

api_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 !")

...

Documentation for API Endpoints

All URIs are relative to https://ws.api.video

CaptionsApi API endpoints

MethodHTTP requestDescription
deleteDELETE /videos/{videoId}/captions/{language}Delete a caption
listGET /videos/{videoId}/captionsList video captions
getGET /videos/{videoId}/captions/{language}Show a caption
updatePATCH /videos/{videoId}/captions/{language}Update caption
uploadPOST /videos/{videoId}/captions/{language}Upload a caption

ChaptersApi API endpoints

MethodHTTP requestDescription
deleteDELETE /videos/{videoId}/chapters/{language}Delete a chapter
listGET /videos/{videoId}/chaptersList video chapters
getGET /videos/{videoId}/chapters/{language}Show a chapter
uploadPOST /videos/{videoId}/chapters/{language}Upload a chapter

LiveStreamsApi API endpoints

MethodHTTP requestDescription
deleteDELETE /live-streams/{liveStreamId}Delete a live stream
delete_thumbnailDELETE /live-streams/{liveStreamId}/thumbnailDelete a thumbnail
listGET /live-streamsList all live streams
getGET /live-streams/{liveStreamId}Show live stream
updatePATCH /live-streams/{liveStreamId}Update a live stream
createPOST /live-streamsCreate live stream
upload_thumbnailPOST /live-streams/{liveStreamId}/thumbnailUpload a thumbnail

PlayerThemesApi API endpoints

MethodHTTP requestDescription
deleteDELETE /players/{playerId}Delete a player
delete_logoDELETE /players/{playerId}/logoDelete logo
listGET /playersList all players
getGET /players/{playerId}Show a player
updatePATCH /players/{playerId}Update a player
createPOST /playersCreate a player
upload_logoPOST /players/{playerId}/logoUpload a logo

RawStatisticsApi API endpoints

MethodHTTP requestDescription
list_live_stream_sessionsGET /analytics/live-streams/{liveStreamId}List live stream player sessions
list_session_eventsGET /analytics/sessions/{sessionId}/eventsList player session events
list_video_sessionsGET /analytics/videos/{videoId}List video player sessions

UploadTokensApi API endpoints

MethodHTTP requestDescription
delete_tokenDELETE /upload-tokens/{uploadToken}Delete an upload token
listGET /upload-tokensList all active upload tokens.
get_tokenGET /upload-tokens/{uploadToken}Show upload token
create_tokenPOST /upload-tokensGenerate an upload token

VideosApi API endpoints

MethodHTTP requestDescription
deleteDELETE /videos/{videoId}Delete a video
getGET /videos/{videoId}Show a video
get_statusGET /videos/{videoId}/statusShow video status
listGET /videosList all videos
updatePATCH /videos/{videoId}Update a video
pick_thumbnailPATCH /videos/{videoId}/thumbnailPick a thumbnail
upload_with_upload_tokenPOST /uploadUpload with an upload token
createPOST /videosCreate a video
uploadPOST /videos/{videoId}/sourceUpload a video
upload_thumbnailPOST /videos/{videoId}/thumbnailUpload a thumbnail

WebhooksApi API endpoints

MethodHTTP requestDescription
deleteDELETE /webhooks/{webhookId}Delete a Webhook
getGET /webhooks/{webhookId}Show Webhook details
listGET /webhooksList all webhooks
createPOST /webhooksCreate Webhook

Documentation For Models


Did this page help you?