简体   繁体   English

如何在GCS python中使用不同的桶?

[英]How to use different buckets in GCS python?

I have:我有:

bucket_name = os.environ.get(
            'mosaictest', app_identity.get_default_gcs_bucket_name())

But It would always show the default gcs bucket(for me it is "{project id}.appspot.com" instead of 'mosaictest'(I created this bucket) how do I use the "mosaictest' bucket?但它总是会显示默认的 gcs 存储桶(对我来说它是“{project id}.appspot.com”而不是“mosaictest”(我创建了这个存储桶)我如何使用“mosaictest”存储桶?

我是个白痴,只写:bucket_name={literally name the bucket you want to use lol}

Your code retrieves the value of an environment variable called mosaictest and uses the value of that variable.您的代码检索名为mosaictest的环境变量的值并使用该变量的值。 If the variable is not set, then you will get the default value as returned from the get_default_gcs_bucket_name() function call.如果未设置该变量,则您将获得从get_default_gcs_bucket_name()函数调用返回的默认值。 If you are finding that you are getting the default value then it is likely your environment variable is not set.如果您发现您获得的是默认值,那么您的环境变量可能未设置。 You didn't specify how you might have been setting it in your original post.您没有在原始帖子中指定如何设置它。 In Linux, you would do something like:在 Linux 中,您会执行以下操作:

export mosaictest=MYVALUE
python myapp.py

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 检查 10 个 GCS 存储桶中的文件 - Check 10 GCS buckets for files apache-beam 从 GCS 桶的多个文件夹中读取多个文件并加载它 biquery python - apache-beam reading multiple files from multiple folders of GCS buckets and load it biquery python Python:将不同列的值分组为时间桶 - Python: Grouping values of different columns into time buckets 如何从 Python 中删除 GCS 文件夹? - How to delete GCS folder from Python? 熊猫如何将行分组为不同的时间段? - Panda how to groupby rows into different time buckets? 如何使用python检查GCS中是否存在桶 - How to check whether a bucket exists in GCS with python 如何在谷歌云存储 python 库中正确使用 create_anonymous_client() 函数来访问公共存储桶? - How to properly use create_anonymous_client() function in google cloud storage python library for access on public buckets? 如何在 Python 中列出 Google Storage 中的存储桶? - How to list buckets from Google Storage in Python? python boto3分段上传到不同区域中的存储桶 - python boto3 multipart upload to buckets in different zones 使用GAE Python GCS客户端库进行访问时,如何在GCS中进行分页? - How to paginate in GCS when using GAE Python GCS Client Library for access ?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM