Giter Site home page Giter Site logo

openapi-python's Introduction

KKBOX OpenAPI SDK for Python

The SDK is for accessing various metadata of KKBOX tracks, albums, artist, playlists and stations.

Installation

Source installation

[sudo] python setup.py install

Pypi installation

pip install kkbox-developer-sdk

The package works with Python 2 and Python 3.

Test

First, go to https://developer.kkbox.com/ to get client id and client secret. If the site is unavailable, you can also contact vincentchiang or chrisyuan at KKBOX to get client id and client secret.

Second, create client.py in the test directory and create a class named ClientInfo, and put your client id and client secret in it. The content will be like:

class ClientInfo():
    client_id = "YOUR_CLIENT_ID"
    client_secret = "YOUR_CLIENT_SECRET"

And then we can run the tests.

How to use the SDK

First we have to obtain the access token.

from kkbox_developer_sdk.auth_flow import KKBOXOAuth
auth = KKBOXOAuth(CLIENT_ID, CLIENT_SECRET)
token = auth.fetch_access_token_by_client_credentials()

After obtaining the access token, you may call APIs like this:

from kkbox_partner_sdk.api import KKBOXAPI
kkboxapi = KKBOXAPI(token)
artist_id = '8q3_xzjl89Yakn_7GB'
artist = kkboxapi.artist_fetcher.fetch_artist(artist_id)

SDK Documentation

Please browse https://kkbox.github.io/OpenAPI-Python/

Generate the SDK documentation

The SDK documentation depends on Sphinx, recommonmark and sphinx-rtd-theme, so first you have to install them.

pip install Sphinx recommonmark sphinx-rtd-theme

Then generate documentation by sphinx:

sphinx-apidoc -o doc -f kkbox_developer_sdk
cd doc
make html

License

Copyright 2017 KKBOX Technologies Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

openapi-python's People

Contributors

sharonyangkk avatar willyliu avatar

Watchers

James Cloos avatar  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.