ファイルをアップロードするために、Flask でBackblaze B2とb2sdk.v2を使用しています。
upload
これは、メソッドを使用して試したコードです:
# I am not showing authorization code...
def upload_file(file):
bucket = b2_api.get_bucket_by_name(bucket_name)
file = request.files['file']
bucket.upload(
upload_source=file,
file_name=file.filename,
)
これは、このようなエラーを示しています
AttributeError: 'SpooledTemporaryFile' object has no attribute 'get_content_length'
FileStorage
パラメータにインスタンスを使用しているためだと思いupload_source
ます。
API を正しく使用しているかどうかを知りたいのですが、そうでない場合はどのように使用すればよいですか?
ありがとう