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:

>>> import jwplatform

Initialize jwplatform client instance (API key and secrets can be found in the JW Platform dashboard under the account tab):

>>> jwplatform_client = jwplatform.Client('API_KEY', 'API_SECRET')

Make an API request. For this example /videos/show API resource is used:

>>> response = jwplatform_client.videos.show(video_key='yYul4DRz')

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

>>> response
{'rate_limit': {'limit': 50, 'remaining': 47, 'reset': 1469105100},
 'status': 'ok',
 'video': {'author': None,
  'custom': {'param1': 'value 1',
   'param2': 'value 2'},
  'date': 1225962900,
  'description': None,
  'duration': '12.0',
  'error': None,
  'expires_date': 1459908560,
  'key': 'yYul4DRz',
  'link': 'http://www.jwplatform.com',
  'md5': 'b2d7312bd39cc60e9facc8ed3cbb6418',
  'mediatype': 'video',
  'size': '29478520',
  'sourceformat': None,
  'sourcetype': 'file',
  'sourceurl': None,
  'status': 'ready',
  'tags': 'new, video',
  'title': 'New test video',
  'upload_session_id': None,
  'views': 123}}

JW Platform API library will raise exception inherited from jwplatform.errors.JWPlatformError if response['status'] set to error. For example, there is no /media/show API resource. Requesting it will raise jwplatform.errors.JWPlatformNotFoundError:

>>> try:
...     jwplatform_client.media.show()
... except jwplatform.errors.JWPlatformNotFoundError as err:
...     print(err.message)
API method `/media/show` not found

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

In addition to raising jwplatform.errors.JWPlatformError exceptions, JW Platform API library will re-raise requests.exceptions.RequestException exceptions from the Requests package.

Source Code

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

License

JW Platform API library is distributed under the MIT license.

Changelog

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jwplatform-1.2.2.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jwplatform-1.2.2-py2.py3-none-any.whl (6.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file jwplatform-1.2.2.tar.gz.

File metadata

  • Download URL: jwplatform-1.2.2.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jwplatform-1.2.2.tar.gz
Algorithm Hash digest
SHA256 333f7b8b520075e877fceee102c5a8b3a85096d87c51207cec91c666f8e6c1db
MD5 fa2522fa5f3b4b45dc0c0c508222e1d0
BLAKE2b-256 6735b9a2c465f5797f414eb72e2f5e0487ba812a97929b15eebc97dd99fd74d5

See more details on using hashes here.

File details

Details for the file jwplatform-1.2.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for jwplatform-1.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e14b76a5b95e43476f354303aa8265ea953dde4c0165b61b54e78e979278c5a0
MD5 ee72b202cf96bdcea34d3876e261071f
BLAKE2b-256 68ffa1a97a299a02b05d3094bbe68a6f1b7d0891f83dd42c835e5adb7605be68

See more details on using hashes here.

Release history Release notifications | RSS feed

2.2.2

2 files

2.2.1

2 files

2.1.3

2 files

2.1.2

2 files

2.1.1

2 files

2.0.1

2 files

2.0.0

2 files

This release

1.2.2 This release

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 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