Hi!
I would like to know why the following code doesnt work. When I run it
I get a "token invalid" error message. I believe this is because the
first request returns an authentication token that has already expired
(the expiration is always jan 1, 1990).
Here's the code:
import httplib
def findAuth(str):
for el in str.splitlines():
if el.startswith("Auth"): return el
return False
connection = httplib.HTTPSConnection("www.google.com")
connection.request("POST",
"/accounts/ClientLogin",
"accountType=GOOGLE&[email protected]&Passwd=mypassword&service=cp&source=myapp",
{"Content-type": "application/x-www-form-urlencoded"})
response = connection.getresponse()
auth_token = findAuth(response.read())
connection.request("GET",
"/m8/feeds/contacts/[email protected]/full",
headers = {"Authorization": "GoogleLogin auth=%s" %
auth_token})
response = connection.getresponse()
print response.read()
Any help appreciated.
//Thomas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Data Protocol" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---