hi Trevor,
I just did wht u said even it showing same error i.e., Non
AuthsubToken
After modifying code appears like this,
try:
from xml.etree import ElementTree
except ImportError:
from elementtree import ElementTree
import gdata.alt.appengine
import gdata.calendar.service
import gdata.service
import atom.service
import atom
import getopt
import sys
import string
import cgi, sys
import cgitb; cgitb.enable() # for troubleshooting
import time
class CalendarExample:
def __init__(self):
print ""
def GetAuthSubUrl(self):
next = 'http://localhost:8080/'
scope = 'http://www.google.com/calendar/feeds/'
secure = False
session = True
self.calendar_service = gdata.calendar.service.CalendarService()
return self.calendar_service.GenerateAuthSubURL(next, scope,
secure, session)
def _login(self):
authSubUrl = self.GetAuthSubUrl()
print '<a href="%s">Login to your Google account</a>' % authSubUrl
parameters = cgi.FieldStorage()
print '<br/> Parameters is %s ' % (parameters,)
if parameters.has_key('token'):
print '<br/>hello'
authsub_token = parameters['token']
print '<br/>AuthSub token is %s ' % (authsub_token,)
self.calendar_service = gdata.calendar.service.CalendarService()
self.calendar_service.auth_token = authsub_token
self.calendar_service.UpgradeToSessionToken()
## feed = calendar_service.GetCalendarListFeed()
## for i, a_calendar in enumerate(feed.entry):
## print '\t%s. %s' % (i, a_calendar.title.text,)
def main():
sample = CalendarExample()
sample._login()
if __name__ == '__main__':
# print '\n Main If condition'
main()
after receiving token i just tried to UpgradeToSessionToken(). But
even it showing same error.
Can u write a script that helpful to me.
regards,
moparthi.
On Sep 17, 2:16 pm, "Trevor Johns" <[EMAIL PROTECTED]> wrote:
> On Fri, Sep 12, 2008 at 4:00 AM, moparthi <[EMAIL PROTECTED]> wrote:
>
> > hi,
>
> > I am doing AuthSub Authentication in python. But i got stucked with
> > some errors :
>
> > Traceback (most recent call last):
> > ...snip...
>
> Moparthi,
> It looks like you're trying to extract the token parameter before the
> user has authenticated. You should wait to call _retrievecals() until
> after the user has completed the login process and been redirected
> back to your application with an AuthSub token.
>
> At the very least, check for the existence of the 'token' key in
> parameters before trying to extract it:
>
> parameters = cgi.FieldStorage()
> if parameters.has_key('token'):
> authsub_token = parameters['token']
> # Do other stuff.
>
> --
> Trevor Johns
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" 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-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---