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
Image Tooᥣs Bot I specialize for logo design Services with Amazing logo Creator Platform and more tools

Image Tooᥣs Bot I specialize for logo design Services with Amazing logo Creator Platform and more tools

Sz Team Bots <sz/>✌️ 10 Oct 21, 2022
An API wrapper library for opensea api.

Opensea API An API wrapper library for opensea api. Installation pip3 install opensea Usage Retrieving assets: from opensea import get_assets # This

Ankush Singh 38 Jul 17, 2022
Um bot simples para seguir as pessoas

Um bot simples para seguir pessoas no instagram, criado apeanas para testes. Utilizando o framework "Selenium", criei um bot para entrar em uma conta

Mobben 1 Nov 05, 2021
An API that allows you to get full information about TikTok videos

TikTok-API An API that allows you to get full information about TikTok videos without using any third party sources and only the TikTok API. ##API onl

FC 13 Dec 20, 2021
A Python library for miHoYo bbs and HoYoLAB Community

A Python library for miHoYo bbs and HoYoLAB Community. genshin 原神签到小助手

384 Jan 05, 2023
A simple script that will watch a stream for you and earn the channel points.

Credits Main idea: https://github.com/gottagofaster236/Twitch-Channel-Points-Miner Bet system (Selenium): https://github.com/ClementRoyer/TwitchAutoCo

Alessandro Maggio 1.1k Jan 08, 2023
Telegram bot to scrape images from the reddit universe

Telegram bot to scrape images from the reddit universe

XD22 3 Sep 30, 2022
Export Statistics for a Telegram Group Chat

Telegram Statistics Export Statistics for a Telegram Group Chat How to Run First, in main repo directory, run the following code to add src to your PY

Ali Hejazizo 22 Dec 05, 2022
This is a Python bot, which automates logging in, purchasing and planting the seeds. Open source bot and completely free.

🌻 Sunflower Land Bot 🌻 ⚠️ Warning I am not responsible for any penalties incurred by those who use the bot, use it at your own risk. This BOT is com

Newerton 18 Aug 31, 2022
My telegram bot to download Instagram Profiles

Instagram Profile Get for Telegram My telegram bot to download Instagram Profiles First you have to get a telegrm bot api key from @BotFather Then you

Ali Yoonesi 2 Sep 22, 2022
Python library for Spurwing API to schedule appointments, manage calendars and custom integrations.

Spurwing API Python Library Lightweight Python library for Spurwing's API. Spurwing's API makes it easy to add robust scheduling and booking to your a

Spurwing 1 Jul 14, 2021
Status-embed - Cool open source profile embed for Discord

Current Status : Incomplete Status Embed Status Embed is an awesome open source

Ritabrata Das 2 Feb 17, 2022
Discord bot written in discord.py

Orion Discord bot written in discord.py Installation Installation of code is supported for macOS only currently First open the terminal. If incase you

Zeus 3 May 19, 2022
An attempt to escape the horrible JIRA editor.

An attempt to escape the horrible JIRA editor. jira_filter.py is a pandoc filter that cleans up some of JIRA's html so that it can be converted to Mar

Stefan Matting 2 Feb 10, 2022
Anchor Protocol Script that can save you from being liquidated!

Why My day job requires a fairly good amount of automation from time to time. Besides, I do like computers to work on what I cannot while I'm sleeping

126 Oct 16, 2022
A python API for BSCScan (Binance Smart Chain Explorer), available on PyPI.

bscscan-python A complete Python API for BscScan.com, available on PyPI. Powered by BscScan.com APIs. This is a gently modified fork of the etherscan-

Panagiotis Kotsias 246 Dec 31, 2022
A simple google translator telegram bot

Translator-Bot A simple google translator telegram bot Please fork this repository don't import code Made with Python3 (C) @FayasNoushad Copyright per

Fayas Noushad 14 Nov 12, 2022
AK-LEECH-BOT - AK LEECH BOT For python

Benefits :- ✓ Google Drive link cloning using gclone.(wip) ✓ Telegram File mirro

5 Mar 24, 2022
DiscWrappy - A Python wrapper for the Discord bot API

DiscWrappy - A Python wrapper for the Discord bot API

Jeff Morris 4 Apr 25, 2022
Trading strategy for the Freqtrade crypto bot

NostalgiaForInfinity Trading strategy for the Freqtrade crypto bot Change strategy Add strategies to the user_data/strategies folder and also in the d

iterativ 1.5k Jan 01, 2023