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
- Set environment variables for
POAURK_TEST_KEYandPOAURK_TEST_SECRET. - 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.
Metadata
Release files for poaurk 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| poaurk-0.6.0.tar.gz | 527.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| poaurk-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 536.4 kB
Release files / poaurk-0.6.0.tar.gz
| Download URL | poaurk-0.6.0.tar.gz |
|---|---|
| Size | 527.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
efb42c8943329a242d6a0ac9679e8f7d7f612744905c965088a4c5b7093bc7ac
|
|
BLAKE2b-256 checksum How to use checksums |
f7dd68fd7d452a9abba3b09648dcf5108b21a2c7f223fa227490c7c9c92f7439
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / poaurk-0.6.0-py3-none-any.whl
| Download URL | poaurk-0.6.0-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31d2bf1c6a4314791b36b1c6af62f4aaed1ebe57fce82c545c49b3bf3cd6b216
|
|
BLAKE2b-256 checksum How to use checksums |
b76f8aa414138027006bcdc5d9fc6e677952f9911d76d76349ac1bd1514ecccc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|