We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug 场景:使用bot.client.create_asset上传视频.mp4文件的时候报错。 报错内容:Requesting 'POST asset/create' failed with 40000: Width必须是整数。 报错堆栈:Traceback (most recent call last): File "C:\Users\Administrator\Downloads_***_bots\kook_bot\kook_bot.py", line 207, in h4 file_url = await bot.client.create_asset(path_to_load) # 上传测试文件 File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\khl\client.py", line 126, in create_asset return (await self.gate.exec_req(api.Asset.create(file=f)))['url'] File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\khl\gateway.py", line 30, in exec_req return await self.requester.exec_req(r) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\khl\requester.py", line 48, in exec_req return await self.request(r.method, r.route, **r.params) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\khl\requester.py", line 39, in request raise HTTPRequester.APIRequestFailed(method, route, params, rsp['code'], rsp['message']) khl.requester.HTTPRequester.APIRequestFailed: Requesting 'POST asset/create' failed with 40000: Width必须是整数。
Expected behavior 正常的上传文件
Environment
报错分析 传递给服务器中的请求的headers中content-type字段缺少boundary字段,原因是khl/requester.py中的第471行为 @req('POST', headers={'Content-Type': 'multipart/form-data'}) 指定了content-type。
@req('POST', headers={'Content-Type': 'multipart/form-data'})
推荐解决办法 将@req('POST', headers={'Content-Type': 'multipart/form-data'})改为@req('POST'),此时程序会自动指定content-type字段
@req('POST')
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
场景:使用bot.client.create_asset上传视频.mp4文件的时候报错。
报错内容:Requesting 'POST asset/create' failed with 40000: Width必须是整数。
报错堆栈:Traceback (most recent call last):
File "C:\Users\Administrator\Downloads_***_bots\kook_bot\kook_bot.py", line 207, in h4
file_url = await bot.client.create_asset(path_to_load) # 上传测试文件
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\khl\client.py", line 126, in create_asset
return (await self.gate.exec_req(api.Asset.create(file=f)))['url']
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\khl\gateway.py", line 30, in exec_req
return await self.requester.exec_req(r)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\khl\requester.py", line 48, in exec_req
return await self.request(r.method, r.route, **r.params)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\khl\requester.py", line 39, in request
raise HTTPRequester.APIRequestFailed(method, route, params, rsp['code'], rsp['message'])
khl.requester.HTTPRequester.APIRequestFailed: Requesting 'POST asset/create' failed with 40000: Width必须是整数。
Expected behavior
正常的上传文件
Environment
报错分析
传递给服务器中的请求的headers中content-type字段缺少boundary字段,原因是khl/requester.py中的第471行为
@req('POST', headers={'Content-Type': 'multipart/form-data'})
指定了content-type。
推荐解决办法
将
@req('POST', headers={'Content-Type': 'multipart/form-data'})
改为@req('POST')
,此时程序会自动指定content-type字段The text was updated successfully, but these errors were encountered: