Skip to main content

A simple comprehensive Python Wrapper for LivePeerAPI.

Project description

LivePeerSDK

Make LivePeerAPICalls from Python

License : MIT

Copyright (c) 2022 RAGAVENDIRAN BALASUBRAMANIAN.
GMAIL : bgragavendiran@gmail.com
LINKEDIN: https://www.linkedin.com/in/ragavendiranbalasubramanian/

Permission is hereby granted, free of charge, to any person obtaining a copy Of this software and associated documentation files (the "software"), to deal In the software without restriction, including without limitation the rights To use, copy, modify, merge, publish, distribute, sublicense, and/or sell Copies of the software, and to permit persons to whom the software is Furnished to do so, subject to the following condition that the owner and source contributors names and details shall not to be removed from the project

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Powered By

N|Solid

Build Status

LivePeerSDK for Python Developed by Team Heptre, is a realtime PythonSDK that directly interlinks with the LivePeerAPI endpoints which makes the life of the user simple.

Features

  • simply start and use livepeer with livePeer=LivePeerSDK(<LIVEPEER_API_KEY>)
  • The Library is highly modular and plug and play in nature
  • Forget handling requests just make the function call.
  • The request responses are all dicts
  • Detailed Docs Feeling Stuck Anywhere?? help() will get you right back on track.

Installation

LivePeerSDK requires python3 to run.

pip install LivePeerSDK

EXAMPLES

Instructions on how to use LivePeerSDK in your own project can be inferred from below.

from LivePeerSDK_Python.LivePeerSDK import LivePeerSDK
LivePeer=LivePeerSDK(str(<YOUR_LIVEPEER_API_KEY>))

for asset in LivePeer.listAssets():
    print(asset["id"])

OUTPUT:
19233508-5a34-4508-b54f-fe71b062d225
21bd42e3-044e-4093-b920-46fc104b395e
67095c2f-beda-47f1-ad04-2787fad529c9
aecfa170-7d50-4e47-93aa-f0cae8912398
a20373cd-5c27-4948-a5cb-bb55de5def70
d8b52bb6-4bda-4059-bd73-e6dae2d88c80
b9ea232c-6b6c-4a36-9a9c-809f2144592f

Process finished with exit code 0

USAGE

Function USAGE
createUploadUrl(name) Creates a new upload url to directly upload a video asset to livepeer
exportAssetToIPFS(assetID) Export a specific assetID to ipfs it initializes a cloud async call in livepeer which creates a respective taskID
importWebAsset(url, name) Import a video Asset to Livepeer from an external URL.
listAssets() List all assets currently uploaded to livepeer in the form of a dictionary
listTasks() List all tasks currently uploaded to livepeer
retrieveAsset(assetID) Retrieve a specific assetId from live peer
retrieveTask(taskID) Retrieve a specific taskId from livepeer with ipfs link
uploadContent(filePATH, assetURL) Create a new Direct Upload URL to directly upload a video Asset to Livepeer

createUploadUrl(name)

:parameter "name":"Example name"

:returns dict { url:, asset:{'id':, 'playbackId':, 'userId':, 'createdAt':, >'status':, 'name':} task:{'id':, 'createdAt':, 'type':, 'outputAssetId':, >'userId':, 'params':{'uploadedObjectKey': }}, 'status':{'phase': , 'updatedAt': <>timestamp>}} }


exportAssetToIPFS(assetID)

:param "assetID":"$AssetID"

:returns {}


importWebAsset(url, name)

:param "url":"$EXTERNAL_URL", "name":"Example name"


listAssets()

:param : NONE :returns <class 'list'> LIST OF DICTIONARIES OF FORMAT [<class 'dict>,...]

FOR UPLOADED VIDEOS { id : <assetID>, hash : [{'hash': , 'algorithm': 'md5'}, {'hash': , 'algorithm': 'sha256'}] name : , size : , status : ready, userId : , createdAt : , updatedAt : , videoSpec : {'format': , 'tracks': [{'fps': , 'type': 'video', 'codec': 'h264', 'width': , 'height': , 'bitrate': , 'duration': , 'pixelFormat': 'yuv420p'}, {'type': 'audio', 'codec': 'aac', 'bitrate': , 'channels': 2, 'duration': , 'sampleRate': }], 'duration': } playbackId : , downloadUrl : }

FOR PENDING VIDEOS { 'id': , 'name': , 'status': 'waiting', 'userId': , 'createdAt': , 'playbackId': , }


listTasks()


:param : NONE

:returns <class 'list'> LIST OF DICTIONARIES OF FORMAT

FOR EXPORT { 'id':, 'type':, 'output': {'export': {'ipfs': {'videoFileCid':,'nftMetadataCid':,'videoFileUrl':,'videoFileGatewayUrl':,'nftMetadataUrl':,'nftMetadataGatewayUrl':,'params': {'export': {'ipfs': {}}},'status': {'phase':,'updatedAt': },'userId':,'createdAt': ,'inputAssetId':} }

FOR IMPORT { 'id': , 'type': 'import', 'output': {'import': {'assetSpec': {'hash': [hash : [{'hash': , 'algorithm': 'md5'}, {'hash': , 'algorithm': 'sha256'}]], 'name': , 'size': , 'type': 'video', 'videoSpec' : {'format': , 'tracks': [{'fps': , 'type': 'video', 'codec': 'h264', 'width': , 'height': , 'bitrate': , 'duration': , 'pixelFormat': 'yuv420p'}, {'type': 'audio', 'codec': 'aac', 'bitrate': , 'channels': 2, 'duration': , 'sampleRate': }], 'duration': } }}}, 'params': {'import': {'uploadedObjectKey': }}, 'status': { 'phase': , 'userId' : , 'createdAt': , 'updatedAt' : , 'outputAssetId': } }


retrieveAsset(assetID)

:param : assetID obtained from createUploadURL(name) :returns <class 'dict'> LIST OF DICTIONARY OF FORMAT

FOR UPLOADED VIDEOS { id : <assetID>, hash : [{'hash': , 'algorithm': 'md5'}, {'hash': , 'algorithm': 'sha256'}] name : , size : , status : ready, userId : , createdAt : , updatedAt : , videoSpec : {'format': , 'tracks': [{'fps': , 'type': 'video', 'codec': 'h264', 'width': , 'height': , 'bitrate': , 'duration': , 'pixelFormat': 'yuv420p'}, {'type': 'audio', 'codec': 'aac', 'bitrate': , 'channels': 2, 'duration': , 'sampleRate': }], 'duration': } playbackId : , downloadUrl : }

FOR PENDING VIDEOS { 'id': , 'name': , 'status': 'waiting', 'userId': , 'createdAt': , 'playbackId': , }


retrieveTask(taskID)

:param : "taskID obtained from listTASKS

:returns <class 'dict'> LIST OF DICTIONARIES OF FORMAT

FOR EXPORT { 'id':, 'type':, 'output': {'export': {'ipfs': {'videoFileCid':,'nftMetadataCid':,'videoFileUrl':,'videoFileGatewayUrl':,'nftMetadataUrl':,'nftMetadataGatewayUrl':,'params': {'export': {'ipfs': {}}},'status': {'phase':,'updatedAt': },'userId':,'createdAt': ,'inputAssetId':} }

FOR IMPORT { 'id': , 'type': 'import', 'output': {'import': {'assetSpec': {'hash': [hash : [{'hash': , 'algorithm': 'md5'}, {'hash': , 'algorithm': 'sha256'}]], 'name': , 'size': , 'type': 'video', 'videoSpec' : {'format': , 'tracks': [{'fps': , 'type': 'video', 'codec': 'h264', 'width': , 'height': , 'bitrate': , 'duration': , 'pixelFormat': 'yuv420p'}, {'type': 'audio', 'codec': 'aac', 'bitrate': , 'channels': 2, 'duration': , 'sampleRate': }], 'duration': } }}}, 'params': {'import': {'uploadedObjectKey': }}, 'status': { 'phase': , 'userId' : , 'createdAt': , 'updatedAt' : , 'outputAssetId': } }


uploadContent(filePATH, assetURL)

:param "filePATH":"PASS THE FILE PATH OF VIDEO IN H264 and AAC codec "assetURL":ASSET URL FOR THE FILE

:returns {}


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

LivePeerSDK-1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

LivePeerSDK-1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file LivePeerSDK-1.0.tar.gz.

File metadata

  • Download URL: LivePeerSDK-1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.3

File hashes

Hashes for LivePeerSDK-1.0.tar.gz
Algorithm Hash digest
SHA256 6a2cd71463bab91ad6625b3a6e65837a576ba1d7fb64f84652cb60edc6313366
MD5 b8b79b1a6704f8f221a0b8fa4cc62119
BLAKE2b-256 c0ada58f5b2d2a10d1e5d300362a0961d68b18e676f546f235894a00a7eb67a7

See more details on using hashes here.

File details

Details for the file LivePeerSDK-1.0-py3-none-any.whl.

File metadata

  • Download URL: LivePeerSDK-1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.3

File hashes

Hashes for LivePeerSDK-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 369960591ef5afc94b3f685ff81cd9984c93defe029a95a4b85c5858fc44077d
MD5 a5e329d34e2b6c0dac5708d9768ec4e5
BLAKE2b-256 40846f7661aacb3cdbdc4d156dcd029020d1540019847d2d633b061b8c594aad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page