Skip to content

Commit

Permalink
Merge pull request #5 from Well2333/dev
Browse files Browse the repository at this point in the history
🚑 修复二维码登录错误
  • Loading branch information
Well2333 authored Aug 27, 2023
2 parents 81e3362 + 7557037 commit 05719c3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
3 changes: 1 addition & 2 deletions bilireq/login/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ async def qrcode_login(self, auth_code=None, retry=-1, interval=1):
try:
resp = await get_qrcode_login_result(auth_code)
auth = Auth()
auth.access_token = resp["token_info"]["access_token"]
auth.refresh_token = resp["token_info"]["refresh_token"]
auth.data = auth.refresh_handler(resp)
return await auth.refresh()
except ResponseCodeError as e:
if e.code != 86039:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies = [
"protobuf>=4.23.4",
]
name = "bilireq"
version = "0.2.9"
version = "0.2.10"
description = "又一个哔哩哔哩请求库"
license = {text = "MIT"}

Expand Down
26 changes: 26 additions & 0 deletions test/test_login.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import asyncio

from bilireq.login import Login

PHONE_NUM = 1
PASSWD = 1


async def main():
print("===== 二维码登录 =====")
login = Login()
image = await login.get_qrcode()
image.show() # type: ignore
await login.qrcode_login(interval=5)

# print("===== 验证码登录 =====") # 不可用
# login = Login()
# await login.send_sms(PHONE_NUM)
# await login.sms_login(input("请输入验证码: "))

# print("==== 账号密码登录 ====") # 不可用
# login = Login()
# await login.pwd_login(str(PHONE_NUM), PASSWD)


asyncio.run(main())

0 comments on commit 05719c3

Please sign in to comment.