Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib2
- url = 'https://test.salesforce.com/services/oauth2/token'
- data = '&grant_type=password&client_id='+CLIENT_ID+'&client_secret='+CLIENT_SECRET+'&username='+username+'&password='+password
- headers = {'X-PrettyPrint' : '1'}
- req = urllib2.Request(url, data, headers)
- res = urllib2.urlopen(req) #this is where it fails!
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- File "C:Python27liburllib2.py", line 126, in urlopen
- return _opener.open(url, data, timeout)
- File "C:Python27liburllib2.py", line 397, in open
- response = meth(req, response)
- File "C:Python27liburllib2.py", line 510, in http_response
- 'http', request, response, code, msg, hdrs)
- File "C:Python27liburllib2.py", line 435, in error
- return self._call_chain(*args)
- File "C:Python27liburllib2.py", line 369, in _call_chain
- result = func(*args)
- File "C:Python27liburllib2.py", line 518, in http_error_default
- raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
- urllib2.HTTPError: HTTP Error 400: Bad Request
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement