【问题标题】:appengine.googleapis: method() takes exactly 1 argument (2 given)appengine.googleapis:method() 只需要 1 个参数(给定 2 个)
【发布时间】:2019-12-09 08:43:28
【问题描述】:

当我尝试使用其余 API 为我的谷歌应用引擎应用程序获取域时,我收到了这个错误。它说 method() 需要 1 个参数(给定 2 个)有人可以帮助我吗?

from google.oauth2 import service_account
from googleapiclient import discovery

SCOPES = ['https://www.googleapis.com/auth/cloud-platform']
SERVICE_ACCOUNT_FILE = 'secret.json'

credentials = service_account.Credentials.from_service_account_file(
            SERVICE_ACCOUNT_FILE, scopes=SCOPES)

rest_service = discovery.build('appengine', 'v1', credentials=credentials)

@app.route('/audit/create', subdomain='<business>', methods=['GET'])
def audit_create(business):
    logging.debug(rest_service.apps().domainMappings().get('apps/branchify-dashboard/domainMappings/sample.branchify.co'))
    return render_template('audit/letsgetstarted.html')

【问题讨论】:

    标签: google-app-engine google-app-engine-python


    【解决方案1】:

    我认为你应该添加

    domainMappingsId

    ,参数名称到你的参数列表。

       rest_service.apps().domainMappings().get(domainMappingsId="apps/branchify-dashboard/domainMappings/sample.branchify.co")
    

    【讨论】:

      【解决方案2】:

      我发现了这个问题并就此发表了一篇中篇文章。对于未来需要此功能的人,您可以在此处查看:https://medium.com/@timothyouano/google-app-engine-custom-domains-getting-and-creating-them-progammatically-using-python-162f9c38ba4

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-03-04
        • 2017-09-15
        • 2018-08-20
        • 1970-01-01
        • 1970-01-01
        • 2014-09-04
        • 2012-03-07
        • 1970-01-01
        相关资源
        最近更新 更多