Package: jwplatform
A Python client library for accessingJW PlatformAPI. VisitJW Player Developersite for more information about JW Platform API.InstallationJW Platform API library can be installed using pip:pipinstalljwplatformLibrary hasRequestspackage as dependency. It will be installed automatically when installing usingpip.UsageImportjwplatformlibrary:fromjwplatform.clientimportJWPlatformClientInitializejwplatformclient 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,responsevariable will contain dictionary with information related to the response and the actual video data inresponse.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 fromjwplatform.errors.APIErrorif anything goes wrong. For example, if there is no media with the specified media_id requesting it will raisejwplatform.errors.NotFoundError:try:jwplatform_client.Media.get(site_id='SITE_ID',media_id='BAD_MEDIA_ID')exceptjwplatform.errors.NotFoundErroraserr:print(err)For the complete list of available exception seejwplatform/errors.pyfile.List calls allow for (optional) querying and filtering. This can be done by passing the query parameters as a dict to thequery_paramskeyword 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, andsortparameters default to 1, 10, and “created:dsc”, respectively. Theqparameter 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 CodeSource code for the JW Platform API library provided onGitHub.V1 ClientThe 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 thev1namespace.importjwplatform.v1api_client=jwplatform.v1.Client('SITE_ID','V1_API_SECRET')LicenseJW Platform API library is distributed under theMIT license.Changelog2.2.2 (2022-12-13)Fix an issue with v2 media uploadsFix an issue with the v2 client import in some examples2.2.1 (2022-05-05)Address Issue #64 by having ThumbnailClient inherit from SiteResourceClient2.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 itself2.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 v2All existing v1 API functionality has been moved to the jwplatform.v1 submodule (from jwplatform).1.3.0 (2019-12-22)remove Python 2 compatibility1.2.2 (2018-04-10)parameters are now included in the request body by default for POST requests1.2.1 (2017-11-20)improved default parameters handling when instantiating clientadded exponential connection backoff1.2.0 (2016-11-22)allow additional Request package params in API requests1.1.0 (2016-11-03)added JWPlatformRateLimitExceededError exception1.0.0 (2016-07-21)Initial release.