Skip to content

clsung/plurk-oauth

Repository files navigation

Plurk-OAuth

Simple Wrapper of Plurk OAuth API

About

Plurk-OAuth is a wrapper for Plurk API 2.0 beta You will need to Sign Up for your own CUSTOMER TOKENs.

Installation

simply:

    $ pip install plurk-oauth

for development:

    $ git clone git@github.com:clsung/plurk-oauth.git
    $ cd plurk-oauth
    $ pip install -e .

API.keys

You will need to save CONSUMER_KEY/CONSUMER_SECRET in API.keys, the format is JSON. The example is below:

{"CONSUMER_SECRET": "I_am_consumer_secret", "ACCESS_TOKEN": "your_access_token", "ACCESS_TOKEN_SECRET": "your_access_token_secret", "CONSUMER_KEY": "I_am_consumer_key"}

Example with API.keys

    from plurk_oauth import PlurkAPI

    plurk = PlurkAPI.fromfile(<path_to_API.keys>)
    print(plurk.callAPI('/APP/Profile/getOwnProfile'))

Example with ACCESS_TOKEN

    from plurk_oauth import PlurkAPI

    plurk = PlurkAPI(CONSUMER_KEY, CONSUMER_SECRET)
    plurk.authorize(ACCESS_TOKEN,ACCESS_TOKEN_SECRET)

    print(plurk.callAPI('/APP/Profile/getOwnProfile'))

    print(plurk.callAPI('/APP/Profile/getPublicProfile', options={'user_id': 4203050}))

    print(plurk.callAPI('/APP/Timeline/uploadPicture', files={'image': '../testimg.jpg'}))

Example without ACCESS_TOKEN

    from plurk_oauth import PlurkAPI

    plurk = PlurkAPI(CONSUMER_KEY, CONSUMER_SECRET)
    plurk.authorize()
    print(plurk.callAPI('/APP/Profile/getOwnProfile'))

Meta

Author

Cheng-Lung Sung :: clsung@gmail.com :: @clsung

About

Plurk OAuth API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages