Hi moparthi,

Once you have your AuthSub session token, you can get it out of your
client object using:

token_string = client.GetAuthSubToken()

Then you could store this somewhere and use it later by setting the
client's token:

client.SetAuthSubToken(token_string)

For example code illustrating AuthSub and App Engine, see the article
I linked to previously (it was this one: 
http://code.google.com/appengine/articles/gdata.html
). If you get stuck, feel free to share some of your code so that I
can get a better idea of how you are using the library.

Happy coding,

Jeff

On Sep 11, 11:10 pm, moparthi <[EMAIL PROTECTED]> wrote:
> Thanks jeff,
>
> Error was rectified and its working fine.
>
> I H've small doubt, after authentication its generating authsub token.
> How to get that token.
>
> I just 
> followedhttp://code.google.com/apis/calendar/developers_guide_python.html
>
> what this have. But how to get that token parameter to retrieve events
> on my calendar
>
> Good day,
>
> regards
> moparthi
> On Sep 11, 12:13 am, "Jeff S (Google)" <[EMAIL PROTECTED]> wrote:
>
> > Hi moparthi,
>
> > I thought of a few suggestions that might help. The first is that the
> > atom and gdata directories from the gdata-python-client/src directory
> > need to be included in the top level directory for your app. The gdata
> > library source code will needs to be uploaded as part of your app.
> > This is my first guess as to why the imports would fail.
>
> > Also, there is an additional line which you must add to your code to
> > tell the gdata library that HTTP requests should use the App Engine
> > urlfetch API (since the default for the gdata library uses raw socket
> > connections which are not allowed in App Engine). In the latest
> > version of the gdata-python-client (version 1.2.0) you would do this:
>
> > import gdata.alt.appengine
> > ...
> > self.cal_client = gdata.calendar.service.CalendarService()
> > gdata.alt.appengine.run_on_appengine(self.cal_client)
>
> > Lastly, I noticed that you are using ClientLogin, which requires a
> > username and password, and these are being passed around in plaintext.
> > I strongly recommend that you switch to using AuthSub authorization
> > instead. I've written an article which explains how to use AuthSub
> > with App Engine which you can find 
> > herehttp://code.google.com/appengine/articles/gdata.html
>
> > Let me know how it goes :)
>
> > Jeff
>
> > On Sep 9, 12:34 am, moparthi <[EMAIL PROTECTED]> wrote:
>
> > > hi,
>
> > > I tried to use calendar service in cgi-script.
>
> > > This is my code
>
> > > try:
> > >   from xml.etree import ElementTree
> > > except ImportError:
> > >   from elementtree import ElementTree
>
> > > import gdata.calendar.service
> > > import gdata.service
> > > import atom.service
> > > import gdata.calendar
> > > ##import atom
> > > ##import getopt
> > > ##import sys
> > > ##import string
>
> > > import cgi, sys
> > > import cgitb; cgitb.enable()  # for troubleshooting
> > > import time
>
> > > ##print "Content-type: text/html"
> > > ##
> > > ##print """
> > > ##       <html>
> > > ##
> > > ##        <head><title>Sample Script</title></head>
> > > ##
> > > ##        <body>
> > > ##
> > > ##          <h3> Sample CGI Script </h3>
> > > ##      """
>
> > > sys.stderr = sys.stdout
>
> > > html =  """
>
> > >   <p>Previous message : %s</p>
> > >   <p> Time is %s</p>
> > >   <p> Age is %s</p>
> > >   <form action="" method="post">
> > >      Enter the User name : <input type="text" name="message"><br/>
> > >      Enter the Password &nbsp;: <input type="password" name="age">
> > >      Select a value :
> > >        <select name="dropdown>
> > >          <option value="RED">red</option>
> > >          <option value="ORANGE">orange</option>
> > >          <option value="BLUE">blue</option>
> > >        </select>
> > >      <input type="submit" value="Submit">
> > >   </form>
>
> > > </body>
>
> > > </html>
> > > """
>
> > > class CalendarExample:
>
> > >   def __init__(self):
> > >       print 'In Class'
> > >       print "You're talking to a %s server." % (sys.platform)
> > >       print "Version is %s " % (sys.version)
> > >       print "<br/>Path is %s" % (sys.path)
>
> > >   def login(self, email, password):
> > >     """Creates a CalendarService and provides ClientLogin auth details
> > > to it.
> > >     The email and password are required arguments for ClientLogin.
> > > The
> > >     CalendarService automatically sets the service to be 'cl', as is
> > >     appropriate for calendar.  The 'source' defined below is an
> > > arbitrary
> > >     string, but should be used to reference your name or the name of
> > > your
> > >     organization, the app name and version, with '-' between each of
> > > the three
> > >     values.  The account_type is specified to authenticate either
> > >     Google Accounts or Google Apps accounts.  See gdata.service or
> > >    http://code.google.com/apis/accounts/AuthForInstalledApps.htmlfor
> > > more
> > >     info on ClientLogin.  NOTE: ClientLogin should only be used for
> > > installed
> > >     applications and not for multi-user web applications."""
>
> > >     print "<h1>Hello</h1>"
> > >     print "<p>Id is %s " % (email,)
> > >     print "<p>Password is %s " % (password,)
>
> > >     self.cal_client = gdata.calendar.service.CalendarService()
> > >     self.cal_client.email = email
> > >     self.cal_client.password = password
> > >     self.cal_client.source = 'Google-Calendar_Python_Sample-1.0'
> > >     self.cal_client.ProgrammaticLogin()
>
> > > def main():
>
> > >   form = cgi.FieldStorage()
> > >   message = form.getvalue("message", "")
> > >   age = form.getvalue("age", "")
>
> > >   now = time.gmtime()
> > >   displayedtime = time.strftime("%A %d %B %Y, %X", now)
> > >   contentheader = "Content-type: text/html"
> > >   print contentheader
> > >   print html % (message, displayedtime, age)
>
> > >   sample = CalendarExample()
> > >   sample.login(message, age)
>
> > > if __name__ == '__main__':
> > > #  print '\n Main If condition'
> > >   main()
>
> > > when i tried to run in google app engine using command
> > > dev_appserver.py cgi
>
> > > it showing an error as
>
> > > importerror : No module named gdata.calendar.service
>
> > > can anyone help me how to use calendar service with cgi
>
> > > regards,
> > > moparthi- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to