Giter Site home page Giter Site logo

c3333 / jwplatform-py Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jwplayer/jwplatform-py

0.0 1.0 0.0 66 KB

:snake: Python library for the JW Platform API

Home Page: https://developer.jwplayer.com/jw-platform/

License: MIT License

Python 98.65% Makefile 1.35%

jwplatform-py's Introduction

JW Platform API Client

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 keys can be created in the JW Platform dashboard on the API Credentials page. Copy the secret value to use here.

jwplatform_client = jwplatform.client.Client('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.

Source Code

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

License

JW Platform API library is distributed under the MIT license.

jwplatform-py's People

Contributors

chris97425 avatar dashtodd avatar dylancaponi avatar eric-weaver avatar gtwohig avatar jdgumz avatar justiniso avatar ksindi avatar onebrownsound avatar polishmatt avatar rjw57 avatar sergeylashin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.