just because I finally took the time to ask the question, Ifound the answer. I had accidentall deleted the [5:] in the return statement of findAuth() :P
//T On Apr 17, 1:15 am, ojve82 <ojv...@gmail.com> wrote: > 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=mym...@gmail.com&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/mym...@gmail.com/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 google-help-dataapi@googlegroups.com To unsubscribe from this group, send email to google-help-dataapi+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---