GCP功能' google.cloud.storage'。模块没有属性' client'
我正在使用Google Cloud功能中的Python 3.8版本,需要将文件存储在我编写的脚本中的存储中。但是我无法创建存储客户端对象。
这是我的代码:
from google.cloud import storage
storage_client = storage.Client()
bucket = storage_client.get_bucket('bucket_name')
blob = bucket.blob("dataframe.csv")
blob.upload_from_string(dataframe.to_csv(index=False))
此代码中的一些以及使用HTTP触发器运行功能时会遇到的错误:
storage_client = storage.Client() AttributeError: 'Storage' object has no attribute 'Client'
它们已安装在unignts.txt文件中
google-cloud-storage
google-api-python-client
google-auth-httplib2
google-auth-oauthlib
oauth2client
argparse
pandas
opentelemetry-api
opentelemetry-instrumentation
I am working with python 3.8 version in Google Cloud Functions and I need to store the file in the storage in the script I wrote. But I can't create storage client object.
This is my code:
from google.cloud import storage
storage_client = storage.Client()
bucket = storage_client.get_bucket('bucket_name')
blob = bucket.blob("dataframe.csv")
blob.upload_from_string(dataframe.to_csv(index=False))
some of this code and the error I get when I run it in functions with HTTP trigger:
storage_client = storage.Client() AttributeError: 'Storage' object has no attribute 'Client'
they are installed in the requirements.txt file
google-cloud-storage
google-api-python-client
google-auth-httplib2
google-auth-oauthlib
oauth2client
argparse
pandas
opentelemetry-api
opentelemetry-instrumentation
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论