I want to connect my odoo with asana project.
but it display
HTTPError: 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()
I have a couple of recommendations for you:
If you do decide to continue using this approach, there are a couple of things you need to do to fix your request to work in
urllib2. Firstly, your query parameters should come after the question mark. Secondly you need to URL encode them usingurllib.urlencode(and then you don't need to include the&s in theparamsdictionary). For example