我尝试了多种方法来上传图片在Python与Dropbox API,这是非常复杂的。在
bot.command(pass_context=True)
async def upload(ctx, *, message):
await bot.say("Downloading the file from the link, hang on...")
url = str(message)
wget.download(url)
await bot.say("Done. Now uploading it to Dropbox...")
o = os.path.basename(url)
with open(o, "rb") as imageFile:
f = imageFile.read()
b = bytearray(f)
dbx.files_upload(b, '/' + o)
因为上传文件需要字节,所以我不知道该怎么做。 我总是犯这个错误
^{pr2}$有什么我不明白的吗?在
就用吧
dbx.files_upload(imageFile.read(), '/' + o)
相关问题 更多 >
编程相关推荐