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