Hello,
I have a certain code working in PHP, which I am migrating to Python
in order to get it work under my App.
This is the original code in PHP which works, at the end I get a nice
long XML feed.
$post_data = array();
$post_data['accountType'] = "HOSTED_OR_GOOGLE";
$post_data['Email'] = "
m...@email.com";
$post_data['Passwd'] = "mypass";
$post_data['service'] = "cp";
$post_data['source'] = "Beta-Api";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "
https://www.google.com/accounts/
ClientLogin" );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_HEADER, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);
print $postResult;
curl_close($ch);
In Python, this would translate to:
url = "
https://www.google.com/accounts/ClientLogin"
payload = "accountType=HOSTED_OR_GOOGLE&service=cp&source=Beta-
Api&Email=my%
40email.com&Passwd=mypass"
result = urlfetch.fetch(url,payload,2)
However, in the Python script, I always get
result.status_code = 403
Error=BadAuthentication
Am I making a mistake in thebuilding the payload parameter?
Thanks for your help