【问题标题】:how to connect odoo with asana?如何将odoo与asana连接起来?
【发布时间】:2016-06-08 11:09:23
【问题描述】:

我想将我的 odoo 与 asana 项目联系起来。 但它显示 HTTP错误:HTTP Error 400: Bad Requesterror.

def execute(self, cr, uid, ids, context=None):
    params = {
        'client_id': '142025919&',
        'client_secret': '9691f60a6ca68&',
        'redirect_uri': 'urn:ief:wg:oauth:2.0:oob&',
        'state' :'somerandmstate'
    }
    headers = {"Content-type": "application/x-www-form-urlencoded"}
    req = urllib2.Request('https://app.asana.com/-/oauth_authorize%s?'%params)

    _logger.info(req)
    content = urllib2.urlopen(req, timeout=TIMEOUT).read()

【问题讨论】:

    标签: openerp asana-api asana-connect


    【解决方案1】:

    我有几个建议给你:

    1. 如果您想使用 Python 连接到 Asana API,我强烈推荐我们的 client library
    2. 您尝试加载的页面是供人使用的。您的应用程序应将人引导至浏览器中的该页面。他们将取回一个可以粘贴到您的应用程序中的令牌。有关详细信息,请参阅our OAuth documentation
    3. 如果您决定继续使用这种方法,您需要做几件事来解决您在urllib2 中工作的请求。首先,您的查询参数应该在问号之后。其次,您需要使用urllib.urlencode 对它们进行URL 编码(然后您不需要在params 字典中包含&s)。例如

      params = urllib.urlencode({
          'client_id': 'someID',
          'client_secret': 'someSecret',
          'redirect_uri': 'urn:ief:wg:oauth:2.0:oob',
          'state': 'somerandmstate'
      })
      req = urllib2.Request('https://app.asana.com/-/oauth_authorize?%s'%params)
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-02
      • 2018-04-06
      • 2021-02-23
      • 2020-05-12
      • 2019-07-16
      • 2010-11-17
      • 2021-09-15
      相关资源
      最近更新 更多