Tutorials · 2 min read

post-it with Python written on it

New code samples for the Python client

When you go to use the Python client, we now have code samples for all the endpoints.

Erikka Innes

May 24, 2021

We recently released a new Python client. To make it easier to work with, I set up basic code samples for every endpoint showing you how your requests should be created. The basic samples are all in the Examples folder in the Python client repository.

Tips for working with the Python client

These are some tips for working with the Python client.

  • Don't mix n' match the Python client's documentation with the docs at docs.api.video. Parameters are sometimes mapped to more Pythonic parameters in the Python client. For example enablesApi becomes enables_api. This isn't the case everywhere, check the code sample and the documentation in the repository.
  • When you're using the API, typically you'll import the endpoint you want to work with. So you'll import the API with 'import apivideo' and then you'll also have an import statement like 'from apivideo.apis import VideosApi' if you want to use the video endpoint. If you also want to use exceptions, you'd add 'from apivideo.exceptions import ApiAuthException.'
  • Authentication is handled for you. It's arranged so you never need to worry about it. You may wonder then, why we provide a way to manually retrieve a refresh token. This is in case your token is exposed. Retrieving a new refresh token will cancel the old one.
  • When you create requests without the client, you'll notice that you open your file in binary, then attach it to a dictionary and send it. In the client, you just open your file in binary, assign that to a variable and send the open file. This is demonstrated in the examples, if the explanation is unclear. For an example, see the upload_video.py sample.
  • Everything for making requests is built using urllib3.

Documentation Examples

If you don't want to use the simplified examples in the code sample folder, you can also use the samples provided by the Python client documentation. Just look up the endpoint you want details about and there are samples provided there.

Try out more than 80 features for free

Access all the features for as long as you need.
No commitment or credit card required

Video API, simplified

Fully customizable API to manage everything video. From encoding to delivery, in minutes.

Built for Speed

The fastest video encoding platform. Serve your users globally with 140+ points of presence. 

Let end-users upload videos

Finally, an API that allows your end-users to upload videos and start live streams in a few clicks.

Affordable

Volume discounts and usage-based pricing to ensure you don’t exceed your budget.