Thanks... give me a little bit of time to try your hints! :)

On 7 Nov, 22:35, Jeff S <[EMAIL PROTECTED]> wrote:
> Hi Giacomo,
>
> It seems like you are on the right track, but I had a couple of
> suggestions which should help. The first deals with calling
> ClientLogin. If you are runnning on App Engine and using ClientLogin,
> you need to add a couple of parameters to your run_on_appengine call
> (as of gdata-python-client version 1.2.2). Please read the Appendix
> section on the following article for an explanation:
>
> http://code.google.com/appengine/articles/gdata.html
>
> I was able to use:
> gd_client = gdata.docs.service.DocsService()
> gdata.alt.appengine.run_on_appengine(gd_client,
>     store_tokens=False, single_user_mode=True)
> gd_client.ClientLogin(my_email, my_password)
>
> Now for the second suggestion :) If you want to run this code on the
> App Engine servers, you won't be able to use urllib2 to make HTTP
> calls (you need to use the App Engine urlfetch API). Also the
> gd_client is already capable of fetching the doc content so you don't
> need to worry about recreating the Authorization header and moving the
> token around. I used the following to get the doc content:
>
> raw_content = gd_client.Get(entry.content.src, converter=str)
>
> Happy coding,
>
> Jeff
>
> On Nov 7, 3:20 am, Giacomo Cucciati <[EMAIL PROTECTED]>
> wrote:
>
> > Hi!
> > I have some problems in retrieving the content of my google docs using
> > Python.
> > I'm workin with GAE but i think this group fits for my problem.
> > I'll try to give you all the informations you need to help me :)
>
> > This is the code i use for the login:
> > ---------------------------------------------------------------------------­----
> > gd_client = gdata.docs.service.DocsService()
> > gdata.alt.appengine.run_on_appengine(gd_client)
> > gd_client.ClientLogin(mymail,mypassword)
> > ---------------------------------------------------------------------------­-----
>
> > Obtained a particular entry from the feed (  feed =
> > gd_client.GetDocumentListFeed()  ), i try to retrieve the html content
> > by this code:
> > ---------------------------------------------------------------------------­-----
> > request = urllib2.Request(entry.content.src)
> > request.add_header('Authorization', gd_client.auth_token)
> > opener = urllib2.build_opener()
> > f = opener.open(request)
> > thecontent = f.read()
> > f.close()
> > ---------------------------------------------------------------------------­-----
>
> > At the end i use this to show the content:
> > ---------------------------------------------------------------------------­--------
> > self.response.headers['Content-Type'] = 'text/plain'
> > self.response.out.write(thecontent)
> > ---------------------------------------------------------------------------­---------
>
> > This is the error I obtain; it starts from the "f =
> > opener.open(request)" line:
>
> > Traceback (most recent call last):
> >   File "C:\Programmi\Google\google_appengine\google\appengine\ext
> > \webapp\__init__.py", line 499, in __call__
> >     handler.get(*groups)
> >   File "C:\Programmi\Google\google_appengine\praxisPyhton
> > \apriDocHtml.py", line 39, in get
> >     f = opener.open(request)
> >   File "C:\Programmi\Python\lib\urllib2.py", line 381, in open
> >     response = self._open(req, data)
> >   File "C:\Programmi\Python\lib\urllib2.py", line 399, in _open
> >     '_open', req)
> >   File "C:\Programmi\Python\lib\urllib2.py", line 360, in _call_chain
> >     result = func(*args)
> >   File "C:\Programmi\Python\lib\urllib2.py", line 1107, in http_open
> >     return self.do_open(httplib.HTTPConnection, req)
> >   File "C:\Programmi\Python\lib\urllib2.py", line 1081, in do_open
> >     except socket.error, err: # XXX what error?
> > AttributeError: 'module' object has no attribute 'error'
>
> > Is there anyone who can halp me?
>
> > THX!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to