Skip to main content

Light Plurk API 2.0 Oauth Library

Project description

poaurk

A lightweight Python client library for the Plurk API with OAuth 1.0a authentication and real-time Comet support.

Features

  • Full OAuth 1.0a authentication flow for Plurk API
  • Command-line and customizable user interaction for OAuth verification
  • Real-time updates and notifications via Comet long-polling
  • Asyncio and aiohttp based for asynchronous HTTP requests
  • Example scripts to help you get started quickly

Requirements

  • Python 3.8+
  • aiohttp
  • oauthlib

Installation

Install the package via pip:

pip install poaurk

Usage

OAuth Authentication

import asyncio
from aiohttp import ClientSession
from poaurk.oauth import OAuthCred, PlurkOAuth

async def main():
    async with ClientSession() as session:
        cred = OAuthCred(
            customer_key="YOUR_CONSUMER_KEY",
            customer_secret="YOUR_CONSUMER_SECRET"
        )
        client = PlurkOAuth(cred, session)
        await client.authorize()
        # Now you can use client to make authenticated API requests

asyncio.run(main())

Real-time Updates with Comet

import asyncio
from aiohttp import ClientSession
from poaurk.comet import PlurkComet, OAuthCred

async def comet_example():
    async with ClientSession() as session:
        cred = OAuthCred(
            customer_key="YOUR_CONSUMER_KEY",
            customer_secret="YOUR_CONSUMER_SECRET",
            token="YOUR_ACCESS_TOKEN",
            token_secret="YOUR_ACCESS_TOKEN_SECRET"
        )
        comet = PlurkComet(cred, session)
        async for update in comet.connect():
            print("Received update:", update)

asyncio.run(comet_example())

Examples

See the examples/ directory for example scripts, including basic authentication.

Running the Basic Authentication Example

  1. Set environment variables for POAURK_TEST_KEY and POAURK_TEST_SECRET.
  2. Run the example script:
python examples/basic_auth.py

Contributing

Contributions are welcome! Please open issues or submit pull requests on GitHub.

License

This project is licensed under the terms of the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poaurk-0.6.0.tar.gz (527.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poaurk-0.6.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file poaurk-0.6.0.tar.gz.

File metadata

  • Download URL: poaurk-0.6.0.tar.gz
  • Upload date:
  • Size: 527.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for poaurk-0.6.0.tar.gz
Algorithm Hash digest
SHA256 efb42c8943329a242d6a0ac9679e8f7d7f612744905c965088a4c5b7093bc7ac
MD5 2123cb80ddcbd13134acaff2061b0cae
BLAKE2b-256 f7dd68fd7d452a9abba3b09648dcf5108b21a2c7f223fa227490c7c9c92f7439

See more details on using hashes here.

File details

Details for the file poaurk-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: poaurk-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for poaurk-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31d2bf1c6a4314791b36b1c6af62f4aaed1ebe57fce82c545c49b3bf3cd6b216
MD5 4376e17e0f7e1bed2c38464a178a591e
BLAKE2b-256 b76f8aa414138027006bcdc5d9fc6e677952f9911d76d76349ac1bd1514ecccc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page