Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.10.3 get_user_info 使用 uid 无法查询 #81

Closed
single-ptilopsis opened this issue Jan 13, 2023 · 3 comments
Closed

v2.10.3 get_user_info 使用 uid 无法查询 #81

single-ptilopsis opened this issue Jan 13, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@single-ptilopsis
Copy link

single-ptilopsis commented Jan 13, 2023

如何复现

test.py

import asyncio

import aiotieba as tb


async def run():
    async with tb.Client() as client:
        user = await client.get_user_info(809141539)
        print(user)
        print(user.user_id)


loop = asyncio.get_event_loop()
loop.run_until_complete(run())

aiotieba.toml

[User]

# default是自定义的BDUSS_key,你可以改成你喜欢的标识
# 该设计是为了方便通过BDUSS_key快速调用BDUSS,这样你就不用每次都填一串很长的东西作为参数
[User.default]
BDUSS = "" # 把你的那一串长长的BDUSS放在这

python 3.9 v2.10.3

<2023-01-13 15:30:51.254> [WARN] [_get_uinfo_getUserInfo] (110000, '请先登录'). user=809141539
<2023-01-13 15:30:51.254> [WARN] [get_user_info] Null input
0
0

python 3.9 v2.9.1

雪景suki
809141539

你希望程序作出何种行为
v2.9.1 所示

@lumina37
Copy link
Owner

这玩意就是要有BDUSS才能用的啊

import asyncio

import aiotieba as tb


async def run():
    async with tb.Client('default') as client:
        user = await client._get_uinfo_getUserInfo(809141539)
        print(user)
        print(user.user_id)


asyncio.run(run())

输出

雪景suki
809141539

@single-ptilopsis
Copy link
Author

看了下请求代码,加上 require=tb.ReqUInfo.OTHER 请求的接口便和 v2.9.1一致,不需要BDUSS

import asyncio

import aiotieba as tb


async def run():
    async with tb.Client() as client:
        user = await client.get_user_info(809141539,require=tb.ReqUInfo.OTHER)
        print(user)
        print(user.user_id)


loop = asyncio.get_event_loop()
loop.run_until_complete(run())

@lumina37 lumina37 added the bug Something isn't working label Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants