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.html for
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

--~--~---------~--~----~------------~-------~--~----~
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