Skip to main content

A Python client library for accessing JW Platform API. Visit JW Player Developer site for more information about JW Platform API.

Installation

JW Platform API library can be installed using pip:

pip install jwplatform

Library has Requests package as dependency. It will be installed automatically when installing using pip.

Usage

Import jwplatform library:

from jwplatform.client import JWPlatformClient

Initialize jwplatform client instance. API keys can be created in the JW Platform dashboard on the API Credentials page. Copy the secret value to use here.

jwplatform_client = JWPlatformClient('API_SECRET')

Make an API request:

response = jwplatform_client.Media.get(site_id='SITE_ID', media_id='MEDIA_ID')

If API request is successful, response variable will contain dictionary with information related to the response and the actual video data in response.json_body:

>>> response.json_body
{"id": "Ny05CEfj",
 "type": "media",
 "created": "2019-09-25T15:29:11.042095+00:00",
 "last_modified": "2019-09-25T15:29:11.042095+00:00",
 "metadata": {
   "title": "Example video",
   "tags": ["new", "video"]
 }}

JW Platform API library will raise exception inherited from jwplatform.errors.APIError if anything goes wrong. For example, if there is no media with the specified media_id requesting it will raise jwplatform.errors.NotFoundError:

try:
    jwplatform_client.Media.get(site_id='SITE_ID', media_id='BAD_MEDIA_ID')
except jwplatform.errors.NotFoundError as err:
    print(err)

For the complete list of available exception see jwplatform/errors.py file.

List calls allow for (optional) querying and filtering. This can be done by passing the query parameters as a dict to the query_params keyword argument on list calls:

response = jwplatform_client.Media.list(
  site_id="SITE_ID",
  query_params={
      "page": 1,
      "page_length": 10,
      "sort": "title:asc",
      "q": "external_id: abcdefgh",
  },
)

All query parameters are optional. page, page_length, and sort parameters default to 1, 10, and “created:dsc”, respectively. The q parameter allows for filtering on different attributes and may allow for AND/OR querying depending on the resource. For full documentation on the query syntax and endpoint specific details please refer to developer.jwplayer.com.

Source Code

Source code for the JW Platform API library provided on GitHub.

V1 Client

The V1 Client remains available for use, but is deprecated. We strongly recommend using the V2 Client when possible.

To use the V1 Client, import the Client from the v1 namespace.

import jwplatform.v1

api_client = jwplatform.v1.Client('SITE_ID', 'V1_API_SECRET')

License

JW Platform API library is distributed under the MIT license.

Changelog

2.2.2 (2022-12-13)

  • Fix an issue with v2 media uploads

  • Fix an issue with the v2 client import in some examples

2.2.1 (2022-05-05)

  • Address Issue #64 by having ThumbnailClient inherit from SiteResourceClient

2.2.0 (2021-11-01)

  • Add support for remaining v2 routes as of official release.

2.1.3 (2021-08-19)

  • Fixed exception handler failing to _str_ represent itself

2.1.2 (2021-03-23)

  • Fixed missing dependency causing import errors after install.

2.1.1 (2021-01-13)

  • Fixed an issue where the v1 client could not be imported from the jwplatform module.

2.1.0 (2021-01-12)

  • Added support for JWPlatform file upload using a multi-part mechanism.

2.0.1 (2021-01-11)

  • Fix a bug on generating the signature when array value is in the query string.

2.0.0 (2020-12-03)

  • Added support for JWPlatform API v2

  • All existing v1 API functionality has been moved to the jwplatform.v1 submodule (from jwplatform).

1.3.0 (2019-12-22)

  • remove Python 2 compatibility

1.2.2 (2018-04-10)

  • parameters are now included in the request body by default for POST requests

1.2.1 (2017-11-20)

  • improved default parameters handling when instantiating client

  • added exponential connection backoff

1.2.0 (2016-11-22)

  • allow additional Request package params in API requests

1.1.0 (2016-11-03)

  • added JWPlatformRateLimitExceededError exception

1.0.0 (2016-07-21)

  • Initial release.

Release files for jwplatform 2.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jwplatform 2.2.2
File Size Uploaded
jwplatform-2.2.2.tar.gz 24.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jwplatform 2.2.2
File Interpreter ABI Platform
jwplatform-2.2.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 47.1 kB

Release files / jwplatform-2.2.2.tar.gz

Download URL jwplatform-2.2.2.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7b5ad1101c2f866df859683d3888abd72fb8eccbd3d1a5a764e44adc6d203804
BLAKE2b-256 checksum
How to use checksums
5e93b61d496cfeb26019836ff63d78f425a3e3dba08db13e6da59a7d4c70af12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.6

Release files / jwplatform-2.2.2-py2.py3-none-any.whl

Download URL jwplatform-2.2.2-py2.py3-none-any.whl
Size 22.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
13c09811e23c8bd6506ceecceb46831cd6c1cef84faf6bfbbd41230fe39c85f0
BLAKE2b-256 checksum
How to use checksums
fea0505fb354a3904fe739e4034c574135da6ce46747c4fff1d8b6efd8b782bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.6

Release history Release notifications | RSS feed

This release

2.2.2 This release

2 release files

2.2.1

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page