1

我尝试使用以下代码向 Salesforce 授权我的帐户:

data = {
    'client_id': settings.CONSUMER_KEY,
    'client_secret': settings.CONSUMER_SECRET,
    'redirect_uri': 'https://DOMAIN.com/salesforce/auth/',
    'grant_type': 'authorization_code',
}
data = urllib.urlencode(data)
result = urllib2.urlopen('https://SALESFORCEDOMAIN.com/services/oauth2/token', data).read()

但仍然收到错误的请求错误。我应该改变什么?

4

1 回答 1

1

你试过httplib2吗?

from httplib2 import Http
from urllib import urlencode
head = Http()
data = dict(name="Whatever", stuff="Hey you")
response, content = head.request("http://domain.com/etc", "METHOD", urlencode(data))
于 2012-05-15T12:17:10.397 回答