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

🐛 discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized #93

Open
3 tasks done
YLKXzhengyangyang opened this issue Nov 6, 2023 · 1 comment

Comments

@YLKXzhengyangyang
Copy link

问题简述

我确定我使用的USER_TOKEN是正确的,因为我使用curl去请求 https://discord.com/api/v9/users/@me这个路径是正常返回了信息,但是当我执行
python task_bot.py 时就会产生这个报错:

`Traceback (most recent call last):
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\http.py", line 803, in static_login
data = await self.request(Route('GET', '/users/@me'))
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\http.py", line 745, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:\wwwroot\midjourney-api\task_bot.py", line 13, in
bot.run(BOT_TOKEN)
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\client.py", line 860, in run
asyncio.run(runner())
File "D:\software\anaconda3\envs\midjourney-api\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "D:\software\anaconda3\envs\midjourney-api\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\client.py", line 849, in runner
await self.start(token, reconnect=reconnect)
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\client.py", line 777, in start
await self.login(token)
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\client.py", line 612, in login
data = await self.http.static_login(token)
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\http.py", line 807, in static_login
raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.
`

复现方式

python task_bot.py

环境信息

  • OS: 操作系统类型及其版本号
  • Python: Python 版本号 (Python 3.10.13)
  • Others: 其它信息

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题
@YiQiu1984
Copy link

是指这个项目不能用吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants