plurk.py


Nameplurk.py JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/shc261392/plurk.py
SummaryAn unofficial Plurk API 2.0 SDK for Python 3.8+.
upload_time2023-08-16 15:14:52
maintainer
docs_urlNone
authorJames Chien
requires_python>=3.8
license
keywords plurk oauth
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # plurk.py
An modern library of interacting with Plurk API 2.0 for Python 3.8+.

![main](https://github.com/shc261392/plurk.py/actions/workflows/ci.yml/badge.svg?branch=main)

## Features

- Access Plurk API with OAuth easily. ([Code example](https://github.com/shc261392/plurk.py/blob/main/examples/quickstart.py))
- Full sync and async API call support.
- Support all API endpoints listed in the official API doc.
- A helper function to subscribe to timeline updates easily. ([Code example](https://github.com/shc261392/plurk.py/blob/main/examples/subscribe_to_updates.py))


## Requirement

- Python 3.8+

Testing dependencies requires Python 3.8+. The package might still works for Python 3.7 though it is not recommended.

## Installation

```shell
$ pip3 install plurk.py
```

## Quickstart

See the example below for how to use **plurk.py**.

Replace the value of `APP_KEY` and `APP_SECRET` with your Plurk app's key and secret.
If you haven't create a Plurk app yet, visit the [App Sign Up](https://www.plurk.com/PlurkApp/create) page
to register your app and retrieve your app key and app secret.

Note that using hardcoded credentials is a bad practice. The script here is only for demonstration purpose, do not use it without modification in production.


```python
from plurk import Client

APP_KEY = '<your-plurk-app-key>'
APP_SECRET = '<your-plurk-app-secret>'


with Client(APP_KEY, APP_SECRET) as client:
    # Get app user's access token
    request_token = client.get_request_token()
    auth_url = client.get_auth_url(request_token)
    print('Plurk OAuth authorization URL (open it with browser): ', auth_url)
    auth_code = input('Please input the authorization code retrieved from authorization URL: ')
    client.fetch_access_token(request_token, auth_code)

    # Access Plurk API
    user_data = client.users.me()
    print('Display name: ', user_data.display_name)
    print('Plurks created: ', user_data.plurks_count)
```

For async example, check [here](https://github.com/shc261392/plurk.py/blob/main/examples/async_get_plurks.py).

## Development

```shell
$ git clone git@github.com:shc261392/plurk.py.git
$ cd plurk.py
$ make test
$ make install
```

`make install` will automatically create a virtualenv in the current folder named `.venv`.

To run test suite:

```shell
$ make test
```

## Dependencies

**plurk.py** depends on the following brilliant works:
- [Authlib](https://github.com/lepture/authlib) for OAuth. The project uses the [forked version](https://github.com/shc261392/authlib).
- [httpx](https://github.com/encode/httpx), a solid library for both sync and async HTTP requests
- [pydantic](https://github.com/pydantic/pydantic) for building data models with great typing and validation support.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/shc261392/plurk.py",
    "name": "plurk.py",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "plurk,oauth",
    "author": "James Chien",
    "author_email": "shc261392@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bc/fa/fc2a3bbcd21e712a5dd003bb11f16a1ca2453a4f8066e6298b6947a891cc/plurk.py-0.0.3.tar.gz",
    "platform": null,
    "description": "# plurk.py\nAn modern library of interacting with Plurk API 2.0 for Python 3.8+.\n\n![main](https://github.com/shc261392/plurk.py/actions/workflows/ci.yml/badge.svg?branch=main)\n\n## Features\n\n- Access Plurk API with OAuth easily. ([Code example](https://github.com/shc261392/plurk.py/blob/main/examples/quickstart.py))\n- Full sync and async API call support.\n- Support all API endpoints listed in the official API doc.\n- A helper function to subscribe to timeline updates easily. ([Code example](https://github.com/shc261392/plurk.py/blob/main/examples/subscribe_to_updates.py))\n\n\n## Requirement\n\n- Python 3.8+\n\nTesting dependencies requires Python 3.8+. The package might still works for Python 3.7 though it is not recommended.\n\n## Installation\n\n```shell\n$ pip3 install plurk.py\n```\n\n## Quickstart\n\nSee the example below for how to use **plurk.py**.\n\nReplace the value of `APP_KEY` and `APP_SECRET` with your Plurk app's key and secret.\nIf you haven't create a Plurk app yet, visit the [App Sign Up](https://www.plurk.com/PlurkApp/create) page\nto register your app and retrieve your app key and app secret.\n\nNote that using hardcoded credentials is a bad practice. The script here is only for demonstration purpose, do not use it without modification in production.\n\n\n```python\nfrom plurk import Client\n\nAPP_KEY = '<your-plurk-app-key>'\nAPP_SECRET = '<your-plurk-app-secret>'\n\n\nwith Client(APP_KEY, APP_SECRET) as client:\n    # Get app user's access token\n    request_token = client.get_request_token()\n    auth_url = client.get_auth_url(request_token)\n    print('Plurk OAuth authorization URL (open it with browser): ', auth_url)\n    auth_code = input('Please input the authorization code retrieved from authorization URL: ')\n    client.fetch_access_token(request_token, auth_code)\n\n    # Access Plurk API\n    user_data = client.users.me()\n    print('Display name: ', user_data.display_name)\n    print('Plurks created: ', user_data.plurks_count)\n```\n\nFor async example, check [here](https://github.com/shc261392/plurk.py/blob/main/examples/async_get_plurks.py).\n\n## Development\n\n```shell\n$ git clone git@github.com:shc261392/plurk.py.git\n$ cd plurk.py\n$ make test\n$ make install\n```\n\n`make install` will automatically create a virtualenv in the current folder named `.venv`.\n\nTo run test suite:\n\n```shell\n$ make test\n```\n\n## Dependencies\n\n**plurk.py** depends on the following brilliant works:\n- [Authlib](https://github.com/lepture/authlib) for OAuth. The project uses the [forked version](https://github.com/shc261392/authlib).\n- [httpx](https://github.com/encode/httpx), a solid library for both sync and async HTTP requests\n- [pydantic](https://github.com/pydantic/pydantic) for building data models with great typing and validation support.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "An unofficial Plurk API 2.0 SDK for Python 3.8+.",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "https://github.com/shc261392/plurk.py"
    },
    "split_keywords": [
        "plurk",
        "oauth"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "713abad954a6d6c3239f483e10385b39b5f09503cb9a5852ded7c3d955134304",
                "md5": "0a6970cedef9b0dcac4c420f520f1ec2",
                "sha256": "a0aedcf454e9b0b431335ce8da0b147e3951f9bfc65e6e72d843c9ffa2e3b89e"
            },
            "downloads": -1,
            "filename": "plurk.py-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0a6970cedef9b0dcac4c420f520f1ec2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 46616,
            "upload_time": "2023-08-16T15:14:50",
            "upload_time_iso_8601": "2023-08-16T15:14:50.540564Z",
            "url": "https://files.pythonhosted.org/packages/71/3a/bad954a6d6c3239f483e10385b39b5f09503cb9a5852ded7c3d955134304/plurk.py-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bcfafc2a3bbcd21e712a5dd003bb11f16a1ca2453a4f8066e6298b6947a891cc",
                "md5": "4a2c328422fe586a43f839e23045cb13",
                "sha256": "6817e57fa5096fe3b4f213f352c147aaf8004b90cd032f8d0555da0dc6a3e5b3"
            },
            "downloads": -1,
            "filename": "plurk.py-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4a2c328422fe586a43f839e23045cb13",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 34995,
            "upload_time": "2023-08-16T15:14:52",
            "upload_time_iso_8601": "2023-08-16T15:14:52.028702Z",
            "url": "https://files.pythonhosted.org/packages/bc/fa/fc2a3bbcd21e712a5dd003bb11f16a1ca2453a4f8066e6298b6947a891cc/plurk.py-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-16 15:14:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "shc261392",
    "github_project": "plurk.py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "plurk.py"
}
        
Elapsed time: 0.18554s