cqwu-ehall/cqwu/methods/auth/oauth.py
brian 60c32861ea
Support get score
Co-authored-by: brian <brian@xtaolabs.com>
2023-03-08 20:48:12 +08:00

18 lines
432 B
Python

from urllib.parse import urlparse
import cqwu
class Oauth:
async def oauth(
self: "cqwu.Client",
url: str,
host: str = None,
):
"""
使用 统一身份认证平台 登录子系统,并且保存 cookie
"""
host = host or urlparse(url).hostname
html = await self.request.get(url, follow_redirects=True)
return None if html.url.host != host else html