python - 托管在应用程序引擎上的 Python 应用程序无法与在本地工作的 Firestore 连接
问题描述
我在 GCP 上创建了一个新项目。我正在尝试从 Python 烧瓶应用程序的 firestore(已经处于本机模式)中选择/添加数据。来自本地环境。我能够连接到 Firestore。但是一旦我在 App 引擎上托管了我的应用程序,我的 API 就无法连接到 Firestore。它抛出以下错误:
TypeError:with_scopes_if_required() 得到了一个意外的关键字参数“default_scopes”
_create_composite_credentials (/layers/google.python.pip/pip/lib/python3.7/site-packages/google/api_core/grpc_helpers.py:238)
我不确定我在这里缺少什么。我感谢任何支持。
谢谢
解决方案
我也遇到了同样的问题,今天刚刚解决。
正如您在更新日志中看到的那样https://googleapis.dev/python/google-api-core/latest/changelog.html最近他们更新了对google-auth
lib 的要求。您需要检查您的 requirements.txt。就我而言,我们固定了两个没有直接使用的库。
google-auth==1.21.1
google-auth-oauthlib==0.4.1
我刚刚从 中删除了它们,requirements.txt
以便自动处理依赖项版本,它解决了这个问题。
所以我想这取决于您的情况,取决于您如何管理依赖项,但您可能想要使用google-auth
版本。
推荐阅读
- java - @Autowire 一个接口作为映射
有可能吗? - activemq-artemis - 30k 地址/队列的 ActiveMQ Artemis Producer 性能问题
- html - 根据当前表单状态在Angular 7+中以交互方式禁用表单提交按钮的最佳方法是什么?
- python - 在熊猫中按组填充缺失日期的有效方法?
- angularjs - ng-attr 插值不适用于 ng-repeat
- matlab - 这条线在 Matlab 中是什么意思?
- java - 无法为 JAR 项目创建测试?
- python-3.x - 什么类型的数据作为参数接收来自 sklearn 的 LinearRegression 实例的方法预测?
- mysql - 单选中的列选择和变量分配
- r - R中的分组条形图显示类别中总数的百分比为高度,颜色为因子,每组为一列数据