Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用python批量上传到google云_Python_Google Cloud Platform - Fatal编程技术网

使用python批量上传到google云

使用python批量上传到google云,python,google-cloud-platform,Python,Google Cloud Platform,我试图使用google cloud python api一次上传多个文件,但遇到了问题。下面是我的代码: client = storage.Client.from_service_account_json("path_to_json") bucket = client.get_bucket(bucket_name) with client.batch(): for i in range(10): try: blob = bucket.blob("m

我试图使用google cloud python api一次上传多个文件,但遇到了问题。下面是我的代码:

client = storage.Client.from_service_account_json("path_to_json")
bucket = client.get_bucket(bucket_name)
with client.batch():
    for i in range(10):
        try:
            blob = bucket.blob("my_blob")
            blob.upload_from_filename("path_to_file",content_type="image/jpeg")
    except Exception as e:
        raise e
然而,这告诉我没有延迟的请求。我尝试过在没有
client.batch()
的情况下执行此操作,但效果太慢。我想知道是否有人遇到过这种情况

谢谢

根据这一点,后端API不支持批处理“媒体”操作