Hi Ivelin, The gdata-python-client usually uses httplib to make HTTP requests to the Google Data servers, but httplib is not available on App Engine, instead the library needs to use urlfetch. To tell your client object to run on App Engine, use
gdata.alt.appengine.run_on_appengine(client) as described in http://code.google.com/appengine/articles/gdata.html Thank you, Jeff On Sep 27, 3:03 pm, "Ivelin Ivanov" <[EMAIL PROTECTED]> wrote: > Jeff, > > Retried with SDK 1.4.1 without luck: > > DEBUG 2008-09-27 21:54:48,217 dev_appserver.py] Executing CGI with env: > {'APPLICATION_ID': 'xxxxxx', > 'AUTH_DOMAIN': 'gmail.com', > 'CONTENT_LENGTH': '', > 'CONTENT_TYPE': 'application/x-www-form-urlencoded', > 'CURRENT_VERSION_ID': '1.1', > 'GATEWAY_INTERFACE': 'CGI/1.1', > 'HTTP_ACCEPT': > 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', > 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', > 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', > 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', > 'HTTP_CONNECTION': 'keep-alive', > 'HTTP_COOKIE': > 'appengine-utilities-session-sid=a5d6e03e11661138ca6e382fa7d88ae023dd5216', > 'HTTP_HOST': 'localhost:8080', > 'HTTP_KEEP_ALIVE': '300', > 'HTTP_REFERER': 'http://localhost:8080/', > 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; > rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2', > 'PATH_INFO': '/scheduleconf', > 'PATH_TRANSLATED': 'C:\\\\work\\\\xxxxxxx', > 'QUERY_STRING': '', > 'REMOTE_ADDR': '127.0.0.1', > 'REQUEST_METHOD': 'GET', > 'SCRIPT_NAME': '', > 'SERVER_NAME': 'localhost', > 'SERVER_PORT': '8080', > 'SERVER_PROTOCOL': 'HTTP/1.0', > 'SERVER_SOFTWARE': 'Development/1.0', > 'TZ': 'UTC', > 'USER_EMAIL': ''} > ERROR 2008-09-27 21:54:48,983 __init__.py] Traceback (most recent call > last): > File "c:\Program > Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", > line 499, in __call__ > handler.get(*groups) > ... > File "c:\Program > Files\Google\google_appengine\lib\site-packages\gdata\service.py", > line 325, in ProgrammaticLogin > content_type='application/x-www-form-urlencoded') > File "c:\Program > Files\Google\google_appengine\lib\site-packages\atom\service.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' > > On Sat, Sep 27, 2008 at 4:39 PM, ivelin > > > > <[EMAIL PROTECTED]> wrote: > > > Jeff, > > > I have the same issues with ProgrammaticLogin and signing-in is not an > > option. My application does not require google sign-in. However it > > needs to be able to work with a Google Calendar via Programmatic > > Login. How can I make it work with the Python Calendar client api? > >http://code.google.com/apis/calendar/developers_guide_python.html#Aut... > > > Thank you, > > On Sep 17, 2:47 pm, Jeff S <[EMAIL PROTECTED]> wrote: > >> Hi AAG, > > >> I can see why this is failing, and it is actually by design. The new > >> version of the library stores the auth tokens in the App Engine > >> datastore - but - it only stores them if there is a current user. > >> Since I imagine you are probably not signed in to your app when you > >> visit this page, the SetCredentials will not work. The simple solution > >> would be to sign in to your app before viewing this page. > > >> There is a way to perform the authorization without signing in, but it > >> would be a bit more complicated in this context, and I'd rather not > >> explain it unless signing in will not suit your needs. > > >> Thank you, > > >> Jeff > > >> On Sep 15, 12:08 pm, AAG <[EMAIL PROTECTED]> wrote: > > >> > Hi Jeff, > > >> > I installed the gdata.py-1.2.1 and in the AppEngine server the same > >> > fault appears. And now in the local server appears the following > >> > fault : > > >> > H:\GAE\Eclipse\AAG\workspace\helloworld\src\gdata\service.py in > >> > PostOrPut(self=<gdata.docs.service.DocsService object at 0x019B9330>, > >> > verb='POST', data=<gdata.GDataEntry object at 0x02305EF0>, uri='/feeds/ > >> > documents/private/full', extra_headers={'Content-Length': '396', > >> > 'Content-Type': 'multipart/related; boundary=END_OF_PART', 'MIME- > >> > version': '1.0', 'Slug': None}, url_params=None, escape_params=True, > >> > redirects_remaining=4, media_source=<gdata.MediaSource object at > >> > 0x022DDAB0>, converter=None) > >> > 949 else: > > >> > 950 raise RequestError, {'status': server_response.status, > > >> > 951 'reason': server_response.reason, 'body': result_body} > > >> > 952 > > >> > 953 def Put(self, data, uri, extra_headers=None, url_params=None, > >> > server_response = <gdata.alt.appengine.HttpResponse object at > >> > 0x02305EB0>, server_response.reason = '', result_body = '<HTML>\n<HEAD> > >> > \n<TITLE>Authorization required</TIT...required</H1>\n<H2>Error 401</ > >> > H2>\n</BODY>\n</HTML>\n' > > >> > <class 'gdata.service.RequestError'>: {'status': 401, 'body': '<HTML> > >> > \n<HEAD>\n<TITLE>Authorization required</TITLE>\n</HEAD>\n<BODY > >> > BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Authorization required</H1> > >> > \n<H2>Error 401</H2>\n</BODY>\n</HTML>\n', 'reason': ''} > >> > args = ({'body': '<HTML>\n<HEAD>\n<TITLE>Authorization required</ > >> > TIT...required</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n', > >> > 'reason': '', 'status': 401},) > >> > message = {'body': '<HTML>\n<HEAD>\n<TITLE>Authorization > >> > required</TIT...required</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML> > >> > \n', 'reason': '', 'status': 401} > > >> > My code is: > > >> > import atom > >> > import atom.service > > >> > import gdata.spreadsheet.text_db > >> > import gdata.spreadsheet.service > > >> > import gdata.docs > >> > import gdata.docs.service > > >> > import gdata.service > >> > import gdata.alt.appengine > >> > import gdata.alt > > >> > import gdata.urlfetch > >> > # Use urlfetch instead of httplib > >> > gdata.service.http_request_handler = gdata.urlfetch > > >> > username = '[EMAIL PROTECTED]' > >> > password = 'password' > > >> > client = gdata.spreadsheet.text_db.DatabaseClient() > >> > gdata.alt.appengine.run_on_appengine(client._GetDocsClient()) > >> > gdata.alt.appengine.run_on_appengine(client._GetSpreadsheetsClient()) > > >> > client.SetCredentials(username, password) > > >> > db = client.CreateDatabase('TestAAG12') > > >> > table = db.CreateTable('Invoice', ['a', 'b', 'c']) > >> > row1 = table.AddRecord({'a':'21', 'b':'2008', 'c':'1'}) > >> > row2 = table.AddRecord({'a':'21', 'b':'2008', 'c':'2'}) > > >> > How can i solve this issue ? > > >> > Thanks in advance, > >> > AAG > >> > Pinxer.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Docs Data APIs" 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-Docs-Data-APIs?hl=en -~----------~----~----~----~------~----~------~--~---
