2

ファイルをアップロードするために、Flask でBackblaze B2b2sdk.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 を正しく使用しているかどうかを知りたいのですが、そうでない場合はどのように使用すればよいですか?

ありがとう

4

1 に答える 1