A simple Python API wrapper for Cloudflare Stream's API.

Overview

python-cloudflare-stream

A basic Python API wrapper for working with Cloudflare Stream.

Arbington.com started off using Cloudflare Stream. We used their API very heavily and pulled out our code into a simple client for others to use. It's not perfect, nor is it close to being complete. But it's a good start for anyone who wishes to contribute!

Installation

pip install python-cloudflare-stream

Setup

You will need a Cloudflare account with Stream minutes added. We recommend starting small with a $5 subscription just to get your feet wet.

Once you have your Cloudflare Stream subscription you'll need:

  • Your Account ID, which you can find in your Cloudflare Dashboard.
  • Your email address you used for Cloudflare
  • Your API key
  • Then run:
from python_cloudflare_stream.client import StreamClient

keys = StreamClient.create_signing_keys()
print(keys)

That will give the PEM key you will need and the "signing token". Save these as they are only displayed once.

Understanding Cloudflare Stream

Stream is a bit different from other platforms. It's very basic, fast, reliable and moderately priced.

Everytime you upload a video, the video receives a "UID". You'll want to store this UID as it's the only way to refer to a video through their API.

Here is some example code to get you started:

from python_cloudflare_stream.client import StreamClient

keys = StreamClient.create_signing_keys('your-cloudflare-account-id', '[email protected]', 'your-api-key')  # Gives you your PEM and signing_token (called an "id") if you don't have that already. These are only displayed once per API call and aren't shown when listing your keys

# Store these somewhere safe.
signing_token = keys['result']['id']
pem = keys['result']['pem']

# Init the client
client = StreamClient(
    auth_email='[email protected]',
    auth_api_key='qwertyqwertyqwertyqwertyqwertyqwerty',
    account_id='asdf1asdf2asdf3asdf4asdf5',
    pem='LS0TEASRASDASDa-VERY-long-string-here=',
    signing_token='qwertyqwertyqwertyqwertyqwerty',
)

# Sample download URL
download_url = 'https://yourwebsite.com/video.mp4'
# Tell Cloudflare to download the sample download URL from above
video_uid, all_data_dict = client.pull_from_url(download_url, 'Test video', require_signed_url=True, watermark_uid=None)

# Get details about a specific video from its video_uid
data = client.get_video(video_uid)

# Get the total minutes in your account, and the total remaining minutes
client.get_total_storage_minutes()
client.get_remaining_cloudflare_minutes()

# Create a download URL from Cloudflare. Wait until its ready, or return a URL that can be used sometime in the future.
download_url = client.get_download_url(video_uid, wait_until_ready=True)

# Delete a video
deleted = client.delete_video(video_uid)

# List up to 1000 videos at once
videos = client.get_all_videos()

Contributing

Happy to accept contributions of any size!

Owner
Arbington
Learn anything from anyone at any time.
Arbington
Console BeautifulDiscord theme manager

BeautifulDiscord theme manager Console script for downloading & managing Discord .css themes via BeautifulDiscord. Setup Simply run # Linux/MacOS pip3

1 Dec 15, 2022
对hermit 的API进行简单的封装,做成了这个python moudle

hermit-py 对hermit 的API进行简单的封装,做成了这个Python Moudle,推荐通过wheel的方式安装。 目前对点击、滑动、模拟输入、找组件、等支持较好,支持查看页面的实时布局信息,再通过布局信息进行点击滑动等操作。 支持剪贴板相关的操作,支持设置剪贴的任意语言内容。

LookCos 40 Jun 25, 2022
My Discord Bot that I used to learn Python. Please disregard the unstructured code!

Botsche My personal Discord Bot. To run this bot, change TOKEN in config.ini to your Discord Bot Token, which can be retrieved from your Discord Dev

Mats Voss 1 Nov 29, 2021
A modular dynamical-systems model of Ethereum's validator economics.

CADLabs Ethereum Economic Model A modular dynamical-systems model of Ethereum's validator economics, based on the open-source Python library radCAD, a

CADLabs 104 Jan 03, 2023
Please Do Not Throw Sausage Pizza Away - Side Scrolling Up The OSI Stack

Please Do Not Throw Sausage Pizza Away - Side Scrolling Up The OSI Stack

John Capobianco 2 Jan 25, 2022
Python wrapper library for World Weather Online API

pywwo Python wrapper library for World Weather Online API using lxml.objectify How to use from pywwo import * setKey('your_key', 'free') w=LocalWeat

World Weather Online 20 Dec 19, 2022
Python package for agilex robotics mobile base platform

This is Python API for Agilex Robotics Mobile base This is a python API for Can communication with Agilex Robotics Mobile base and controlling it. Sup

7 Sep 06, 2022
Netflix Movies and TV Series Downloader Tool including CDM L1 which you guys can Donwload 4K Movies

NFRipper2.0 I could not shared all the code here Because its has lots of files inisde it https://new.gdtot.me/file/86651844 - Downoad File From Here.

Kiran 15 May 06, 2022
thumbor is an open-source photo thumbnail service by globo.com

Survey If you use thumbor, please take 1 minute and answer this survey? It's only 2 questions and one is multiple choice!!! thumbor is a smart imaging

Thumbor (by @globocom) 9.3k Dec 31, 2022
Twitter automation tool for growing organic followers.

Tiwoto Tiwoto is a simple python program that automates some kind of behaviors and keep your account active. Create an .env file in this directory and

Mehmetcan Yildiz 6 Sep 22, 2022
A Python SDK for Tinybird 🐦

Verdin Verdin is a tiny bird, and also a Python SDK for Tinybird . Install pip install verdin Usage Query a Pipe # the tinybird module exposes all im

LocalStack 13 Dec 14, 2022
Telegram Group Calls Streaming bot with some useful features, written in Python with Pyrogram and Py-Tgcalls. Supporting platforms like Youtube, Spotify, Resso, AppleMusic, Soundcloud and M3u8 Links.

Yukki Music Bot Yukki Music Bot is a Powerful Telegram Music+Video Bot written in Python using Pyrogram and Py-Tgcalls by which you can stream songs,

Team Yukki 996 Dec 28, 2022
Price checker windows application

Price-Checker price checker windows application This application monitors the prices of selected products and displays a notification if the price has

Danila Tsareff 1 Nov 29, 2021
Yes, it's true :orange_heart: This repository has 346 stars.

Yes, it's true! Inspired by a similar repository from @RealPeha, but implemented using a webhook on AWS Lambda and API Gateway, so it's serverless! If

512 Jan 01, 2023
Programa de código abierto para probar el API de Bitso, el exchange más importante de América Latina.

Bitso Semiautomático Programa de código abierto para probar el API de Bitso, el exchange más importante de América Latina. Desarrollador Fernando Mire

Fernando Mireles 17 Dec 07, 2022
Python + AWS Lambda Hands OnPython + AWS Lambda Hands On

Python + AWS Lambda Hands On Python Criada em 1990, por Guido Van Rossum. "Bala de prata" (quase). Muito utilizado em: Automatizações - Selenium, Beau

Marcelo Ortiz de Santana 8 Sep 09, 2022
Simple Translator in Python

Simple Translator in Python Project Description: In this project, we'll be making a very simple translator in Python using some libraries. Requirement

Hassan Shahzad 3 Jan 23, 2022
Add members to unlimited telegram channels and groups

Program Features 📌 Coded with Python version 10. 📌 without the need for a proxy. 📌 without the need for a Telegram ID. 📌 Ability to add infinite p

hack4lx 10 Nov 25, 2022
🎥 Stream your favorite movie from the terminal!

Stream-Cli stream-cli is a Python scrapping CLI that combine scrapy and webtorrent in one command for streaming movies from your terminal. Installatio

R E D O N E 379 Dec 24, 2022
Some Discord bot block bad words, with this simple hacking tool you will be able to bypass blacklisted words

DISCORD-BAD-WORD-BYPASS-2022 DISCORD BLACKLISTED WORDS HACKING/BYPASS (EDUCATIONAL PURPOSES ONLY) bypass discord blacklisted words. Description Some D

6 Nov 20, 2022