python REST API access fails after adding date to URL

mahsan9861 at gmail.com mahsan9861 at gmail.com
Tue Sep 10 11:42:31 EDT 2013


Found a solution. For query string you have to add it to both the http_headers dictionary AND to the URL when making the Request.

<h2>old line:</h2>
http_headers = {} 
http_headers['oauth_version'] = '1.0' 
<h2>new line:</h2>
http_headers = {} 
http_headers['date'] = 'ddmmyyyy' #add this line
http_headers['oauth_version'] = '1.0' 

<h2>old line:</h2>
req = urllib2.Request(base_url) 
<h2>new line:</h2>
req = urllib2.Request(base_url + '?date=ddmmyyyy') 



More information about the Python-list mailing list