【问题标题】:Calling Google Apps Marketplace UpgradeableApp API with Python Appengine App使用 Python Appengine App 调用 Google Apps Marketplace UpgradeableApp API
【发布时间】:2014-11-11 07:12:09
【问题描述】:

是否可以从 Python Appengine 应用程序调用 Google Apps Marketplace UpgradeableApp API?唯一可用的示例似乎是 Java / Ruby。

我们的应用程序是用 Python / Appengine 编写的,因此我们希望使用它 - 任何示例代码都将不胜感激。

在 Ruby 中,它似乎很简单:

consumer = OAuth::Consumer.new(consumer_key, consumer_secret, { site: "https://www.googleapis.com" }) 
resp = consumer.request(:put, "/appsmarket/v2/upgradableApp/#{listingId}/#{cwsId}/#{domain}") puts resp.code+"\n" puts resp.body

干杯, 伊恩。

【问题讨论】:

    标签: google-app-engine python-2.7 google-oauth google-apps-marketplace


    【解决方案1】:

    最困难的部分将是 OAuth1.0 流程。 OAuth 网站列出了一些可用于 Python 的库:

    http://oauth.net/code/

    一旦您完成了 OAuth 部分,只需像您在问题中包含的那样发出 PUT 请求。

    【讨论】:

      【解决方案2】:

      好的,我现在已经解决了这个问题 - 下面的 python 代码,虽然没有记录,但您可以使用 oauth2 库来提供 oauth 身份验证部分:

      url = 'https://www.googleapis.com/appsmarket/v2/upgradableApp/oldlisting/newlisting/mybeacon.biz'
      
      consumer_key = 'key'
      consumer_secret = 'secret'
      
      consumer = oauth.Consumer(consumer_key, consumer_secret)
      
      client = oauth.Client(consumer)
      
      # Step 1: Get a request token. This is a temporary token that is used for
      # having the user authorize an access token and to sign the request to obtain
      # said access token.
      
      resp, content = client.request(url, "PUT")
      

      希望对你有所帮助...

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-07-28
        • 2023-04-02
        • 1970-01-01
        • 2014-02-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多