【发布时间】:2021-05-03 10:29:34
【问题描述】:
我正在尝试从 dict 设置环境变量,但连接时出现错误。
#service account pulls in airflow variable that contains the json dict with service_account credentials
service_account = Variable.get('google_cloud_credentials')
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]=str(service_account)
错误
PermissionDeniedError: Error executing an HTTP request: HTTP response code 403 with body '<?xml version='1.0' encoding='UTF-8'?><Error><Code>AccessDenied</Code><Message>Access denied.</Message><Details>Anonymous caller does not have storage.objects.get access to the Google Cloud Storage object.</Details></Error>'
阅读时如果我使用并指向文件则没有问题。
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]=/file/path/service_account.json
我想知道有没有办法将 dict 对象转换为类似对象的 os 路径?我不想将 json 文件存储在容器上,而且气流/google 文档根本不清楚。
【问题讨论】:
标签: python google-cloud-storage airflow