Hi moparthi,

It looks like your app is trying to use httplib to make the requests
(the default behavior for the gdata-python-client library) but when
running in App Engine, you must use urlfetch to make HTTP requests. To
allow the gdata-python-client library to run on App Engine, you need
to include the following

import gdata.alt.appengine
...
self.calendar_service = gdata.calendar.service.CalendarService()
gdata.alt.appengine.run_on_appengine(self.calendar_service)

For more details see the following article: 
http://code.google.com/appengine/articles/gdata.html

Cheers,

Jeff

On Sep 14, 10:11 pm, moparthi <[EMAIL PROTECTED]> wrote:
> Hi,
>
> ok, this is my code wht i'm doing.
>
> 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 _retrievecals(self):
>     parameters = cgi.FieldStorage()
>     authsub_token = parameters.getvalue("token",'')
>     print '<br/>AuthSub token is %s' %(authsub_token,)
> ##    authsub_token1 = parameters['token']
>     self.calendar_service = gdata.calendar.service.CalendarService()
>     self.calendar_service.auth_token = authsub_token
>     print '<br/><p> Calendar Auth sub is %s ' %
> (self.calendar_service.auth_token,)
>     return authsub_token
> ##    self.calendar_service.UpgradeToSessionToken()
>
>   def _login(self):
>     authSubUrl = self.GetAuthSubUrl()
>     print '<a href="%s">Login to your Google account</a>' % authSubUrl
>
>     value=self._retrievecals()
>     if value is not '':
>       print '<br/>hello'
>       parameters = cgi.FieldStorage()
>       authsub_token1 = parameters['token']
>       print '<br/>Auth Sub token1 is %s ' % (authsub_token1,)
>       self.calendar_service = gdata.calendar.service.CalendarService()
>       self.calendar_service.auth_token = authsub_token1
>       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 retrieving token Just I tried to Updgrade to session token it is
> showing some socket error.
>
> Traceback (most recent call last):
>   File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \dev_apps
> erver.py", line 2272, in _HandleRequest
>     base_env_dict=env_dict)
>   File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \dev_apps
> erver.py", line 339, in Dispatch
>     base_env_dict=base_env_dict)
>   File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \dev_apps
> erver.py", line 1759, in Dispatch
>     self._module_dict)
>   File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \dev_apps
> erver.py", line 1670, in ExecuteCGI
>     reset_modules = exec_script(handler_path, cgi_path, hook)
>   File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \dev_apps
> erver.py", line 1573, in ExecuteOrImportScript
>     script_module.main()
>   File "C:\Program Files\Google\google_appengine\demos\pythontest\cgi
> \test4.py",
>  line 60, in main
>     sample._login()
>   File "C:\Program Files\Google\google_appengine\demos\pythontest\cgi
> \test4.py",
>  line 53, in _login
>     self.calendar_service.UpgradeToSessionToken()
>   File "C:\Program Files\Google\google_appengine\demos\pythontest\cgi
> \gdata\serv
> ice.py", line 433, in UpgradeToSessionToken
>     content_type='application/x-www-form-urlencoded')
>   File "C:\Program Files\Google\google_appengine\demos\pythontest\cgi
> \atom\servi
> ce.py", line 316, in HttpRequest
>     connection.endheaders()
>   File "C:\Python25\lib\httplib.py", line 860, in endheaders
>     self._send_output()
>   File "C:\Python25\lib\httplib.py", line 732, in _send_output
>     self.send(msg)
>   File "C:\Python25\lib\httplib.py", line 699, in send
>     self.connect()
>   File "C:\Python25\lib\httplib.py", line 1133, in connect
>     sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> AttributeError: 'module' object has no attribute 'socket'
> INFO     2008-09-15 05:08:20,760 dev_appserver.py] "GET /?
> token=CPiz26mXAhCDx7aa
> Aw HTTP/1.1" 500 -
>
> I may be mistaken some where plz let you know me that.
>
> 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