A modern Python SDK for the Plurk API
Project description
qlurk-python
Plurk API 的現代化 Python SDK。
- Python 3.11+
- OAuth 1.0a 認證
- 乾淨的 namespace 介面(
client.timeline、client.users、…) - 單一執行期相依套件:
httpx
安裝
pip install qlurk
事前準備
你需要自己註冊一個 Plurk OAuth 應用程式。到 https://www.plurk.com/PlurkApp/
註冊後可取得 consumer_key 與 consumer_secret,每次建立 PlurkClient 時都必須傳入 —— qlurk
本身不提供任何預設憑證。
快速開始
已有 access token 的情況
from qlurk import PlurkClient
with PlurkClient(
consumer_key="YOUR_CONSUMER_KEY",
consumer_secret="YOUR_CONSUMER_SECRET",
token="USER_ACCESS_TOKEN",
token_secret="USER_TOKEN_SECRET",
) as client:
me = client.users.me()
plurks = client.timeline.get_plurks()
for p in plurks:
print(p.url, p.content_raw)
使用帳密登入
from qlurk import PlurkClient
client = PlurkClient(
consumer_key="YOUR_CONSUMER_KEY",
consumer_secret="YOUR_CONSUMER_SECRET",
)
user = client.login("nickname", "password", totp_code=123456)
# token 會自動存在 client 內部,後續呼叫皆為已認證狀態。
自訂 header
所有非必要 header(例如 User-Agent)都透過單一的 headers 參數傳入,每一個
請求都會帶上。qlurk 本身除了 OAuth 的 Authorization 之外不會送出任何預設
header。若 key 衝突,OAuth header 會蓋過使用者傳入的值。
client = PlurkClient(
consumer_key="...",
consumer_secret="...",
headers={
"User-Agent": "MyBot/1.0",
"Plurk-App-Version": "my-client/1.0",
},
)
API namespace
PlurkClient 以 lazy 方式暴露下列 namespace:
| Namespace | 用途 |
|---|---|
timeline |
貼文、轉噗、收藏、已讀狀態 |
users |
使用者資料、karma、頭像上傳 |
responses |
回應噗文 |
profile |
公開個人資料 |
friends |
朋友、粉絲、追蹤 |
alerts |
通知、好友邀請 |
blocks |
封鎖的使用者 |
cliques |
朋友分組 |
bookmarks |
已收藏的噗與標籤 |
search |
噗與使用者搜尋 |
emoticons |
自訂表情符號 |
polls |
噗內投票 |
reactions |
Emoji 反應 |
video |
影片上傳與預覽 |
premium |
噗幣、禮物、廣告 |
forum |
論壇管理 |
錯誤處理
from qlurk import PlurkError, AuthError, NotFoundError, RateLimitError
try:
client.users.me()
except AuthError:
...
except RateLimitError:
...
except NotFoundError:
...
except PlurkError as e:
print(e.raw) # 原始 API 回傳的 dict
非噗浪官方
本專案與噗浪公司無任何關係,僅為民間愛好者作品。製作過程大量使用 claude code。
其中使用到噗浪官方 API 文件中未記載的 API Endpoint(如 Forum、Reaction、Video...等)。 這部分的功能噗浪未承諾其長期相容性。
授權條款
本專案以 Apache License 2.0 授權。詳見 LICENSE。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qlurk-0.1.0.tar.gz.
File metadata
- Download URL: qlurk-0.1.0.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17d5c737f3bb110ae735f2a40bddd653a47aa736668acf447976e9fe10ef4cb4
|
|
| MD5 |
caff933897b882cda0a6d4b46c0dbab5
|
|
| BLAKE2b-256 |
04c119a6db9c710dd9ea20d803862d0b137d9d2ff44910627af25210d6763030
|
Provenance
The following attestation bundles were made for qlurk-0.1.0.tar.gz:
Publisher:
publish.yml on CQD/qlurk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qlurk-0.1.0.tar.gz -
Subject digest:
17d5c737f3bb110ae735f2a40bddd653a47aa736668acf447976e9fe10ef4cb4 - Sigstore transparency entry: 1270693931
- Sigstore integration time:
-
Permalink:
CQD/qlurk-python@40de3e9931ec480f3b9cce56b110692bf67daab2 -
Branch / Tag:
refs/tags/v0.0.0 - Owner: https://github.com/CQD
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@40de3e9931ec480f3b9cce56b110692bf67daab2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file qlurk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: qlurk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96eb4979d0a8045383f191ecaff532ea89912bcdabac672697928c000b632183
|
|
| MD5 |
61a840cb92a18a8c791055f8668efdc2
|
|
| BLAKE2b-256 |
decc0e30ffa3d7377fca8dcacef025b38e8cd6a7609bd8f989216838602813e5
|
Provenance
The following attestation bundles were made for qlurk-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on CQD/qlurk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qlurk-0.1.0-py3-none-any.whl -
Subject digest:
96eb4979d0a8045383f191ecaff532ea89912bcdabac672697928c000b632183 - Sigstore transparency entry: 1270693940
- Sigstore integration time:
-
Permalink:
CQD/qlurk-python@40de3e9931ec480f3b9cce56b110692bf67daab2 -
Branch / Tag:
refs/tags/v0.0.0 - Owner: https://github.com/CQD
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@40de3e9931ec480f3b9cce56b110692bf67daab2 -
Trigger Event:
release
-
Statement type: