hi Trevor,
This is my code, which I try to get AuthSub Token.
try:
from xml.etree import ElementTree
except ImportError:
from elementtree import ElementTree
from google.appengine.api import users
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()
if parameters.has_key('token'):
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()
# print '<br/>Current user is %s ' %(self.current_user.email(),)
# feed = calendar_service.GetCalendarListFeed()
# print '<br/>Feed is %s ' % (feed,)
## 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()
But, it shows an error as "NonAuthSubToken".
regards,
Sri
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---