-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dephilia <[email protected]>
- Loading branch information
Showing
10 changed files
with
989 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import asyncio | ||
import os | ||
|
||
from aiohttp import ClientSession | ||
|
||
from poaurk import OAuthCred, PlurkOAuth | ||
|
||
|
||
async def main() -> None: | ||
oauth_cred = OAuthCred( | ||
os.environ["POAURK_TEST_KEY"], os.environ["POAURK_TEST_SECRET"], None, None | ||
) | ||
|
||
async with ClientSession() as session: | ||
plurk_oauth = PlurkOAuth(oauth_cred, session) | ||
|
||
# Step 1: Get request token | ||
await plurk_oauth.get_request_token() | ||
print(f"Request Token: {oauth_cred.token}") | ||
print(f"Token Secret: {oauth_cred.token_secret}") | ||
|
||
# Step 2: Get verification URL | ||
verifier_url = plurk_oauth.get_verifier_url() | ||
print(f"Visit this URL to authorize: {verifier_url}") | ||
|
||
# Step 3: Get user input for verifier code | ||
verifier_code = await plurk_oauth.get_verifier() | ||
|
||
# Step 4: Get access token | ||
await plurk_oauth.get_access_token(verifier_code) | ||
print(f"Access Token: {oauth_cred.token}") | ||
print(f"Access Token Secret: {oauth_cred.token_secret}") | ||
|
||
# Step 5: Test request | ||
app_users_me = await plurk_oauth.request("/APP/Users/me") | ||
print(app_users_me) | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,28 @@ | ||
[project] | ||
name = "poaurk" | ||
version = "0.4.0" | ||
dynamic = ["version", "readme"] | ||
description = "Light Plurk API 2.0 Oauth Library" | ||
authors = [ | ||
{ name = "Dephilia", email = "[email protected]" } | ||
] | ||
dependencies = [ | ||
"aiohttp>=3.9.3", | ||
"oauthlib>=3.2.2", | ||
] | ||
readme = "README.md" | ||
authors = [{ name = "Dephilia", email = "[email protected]" }] | ||
dependencies = ["aiofiles>=24.1.0", "aiohttp>=3.9.3", "oauthlib>=3.2.2"] | ||
requires-python = ">= 3.10" | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.rye] | ||
managed = true | ||
dev-dependencies = [ | ||
"pytest>=8.1.1", | ||
"pytest-aiohttp>=1.0.5", | ||
"mypy>=1.9.0", | ||
"ruff-lsp>=0.0.53", | ||
"ruff>=0.4.4", | ||
"pyright>=1.1.362" | ||
] | ||
[dependency-groups] | ||
dev = ["pytest>=8.3.4", "pytest-asyncio>=0.25.3"] | ||
|
||
[tool.hatch.metadata] | ||
allow-direct-references = true | ||
[build-system] | ||
requires = ["setuptools", "setuptools-scm"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["src/poaurk"] | ||
[tool.setuptools.dynamic] | ||
version = {attr = "setuptools_scm.get_version"} | ||
readme = {file = "README.md", content-type = "text/markdown"} | ||
|
||
[tool.ruff.lint] | ||
select = ["E", "W", "N", "D", "F", "PL", "UP", "I"] | ||
|
||
[tool.pyright] | ||
exclude = [ ".venv" ] | ||
venvPath = "." | ||
venv = ".venv" | ||
|
||
[tool.pytest.ini_options] | ||
asyncio_mode = "auto" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""Python Plurk Oauth Library.""" | ||
from .oauth import OauthCred, PlurkOAuth | ||
|
||
__all__ = ["PlurkOAuth", "OauthCred"] | ||
from .oauth import CliUserInteraction, OAuthCred, PlurkOAuth | ||
|
||
__all__ = ["CliUserInteraction", "OAuthCred", "PlurkOAuth"] |
Oops, something went wrong.