Skip to content

Commit baf00e9

Browse files
committed
fix: wechat oauth serialize cookies
1 parent ffdec44 commit baf00e9

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

maimai_py/api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,11 @@ def _callback(to: dict, scores: MaimaiScores, err: BaseException | None, kwargs:
479479

480480
return router
481481

482-
def get_utils_route(self) -> APIRouter:
483-
"""Get a FastAPI APIRouter with routes for utility functions.
482+
def get_wechat_oauth_route(self) -> APIRouter:
483+
"""Get a FastAPI APIRouter with route for wechat oauth URL generation.
484484
485485
Returns:
486-
APIRouter: A FastAPI APIRouter with utility routes.
486+
APIRouter: A FastAPI APIRouter with the wechat_oauth route.
487487
"""
488488
router = APIRouter()
489489

@@ -550,7 +550,7 @@ async def lifespan(app: FastAPI):
550550
)
551551

552552
# other utils routes
553-
asgi_app.include_router(routes.get_utils_route(), prefix="/utils", tags=["utils"])
553+
asgi_app.include_router(routes.get_wechat_oauth_route(), prefix="/utils", tags=["utils"])
554554

555555
def main(
556556
host: Annotated[str, typer.Option(help="The host address to bind to.")] = "127.0.0.1",

maimai_py/providers/wechat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ async def get_identifier(self, code: Union[str, dict[str, str]], client: "Maimai
104104
resp = await client._client.get("https://tgk-wcaime.wahlap.com/wc_auth/oauth/callback/maimai-dx", params=code, headers=headers)
105105
if resp.status_code == 302 and resp.next_request:
106106
resp_next = await client._client.get(resp.next_request.url, headers=headers)
107-
return PlayerIdentifier(credentials=resp_next.cookies)
107+
return PlayerIdentifier(credentials=dict(resp_next.cookies))
108108
else:
109109
raise InvalidWechatTokenError("Invalid or expired Wechat token")
110110
raise InvalidWechatTokenError("Invalid Wechat token format, expected a dict with 'r', 't', 'code', and 'state' keys")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "maimai-py"
3-
version = "1.3.7rc4"
3+
version = "1.3.7rc5"
44
description = "The definitive python wrapper for MaimaiCN."
55
authors = ["Usagi no Niku <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)