Signing URLs in Python

Hello,

I am trying to sign my video URLs in Python, but the example given to do this is in JS. I am not familiar enough with JS so I am not sure how to convert the example code. Has anyone done this in Python before?

Reference article: https://developers.cloudflare.com/stream/viewing-videos/securing-your-stream#step-2-generate-tokens-using-the-key

I’ve shared a GitHub Gist for this: Generate signed tokens for Cloudflare Stream in Python · GitHub

Basically, it uses the jwcrypto library to abstract all the tedious process of managing signing. You’ll see it’s just a few lines to generate a valid token.

Cheers!

1 Like

We just released a small Python wrapper for Cloudflare Stream. Signing URLs is included in it.

GitHub - Arbington/python-cloudflare-stream: A simple Python API wrapper for Cloudflare Stream's API. is the package
python-cloudflare-stream/client.py at main · Arbington/python-cloudflare-stream · GitHub is the signed URL code.