The correct scope is http://www.google.com/base/feeds/items

But if you have a multiple client account its
http://www.google.com/base/feeds/YOUR_CUSTOMER_ID/items

Tom Wilson
Freelance Google Base Developer and Consultant
www.tomthedeveloper.com

Google Base Tools - http://dev.tomthedeveloper.com/googlebase
Featured Project : 
http://google-code-featured.blogspot.com/2008/02/google-base-competitor-analysis.html

On Feb 15, 11:21 pm, svetlin <[email protected]> wrote:
> Hi all,
>
> I've been trying to insert items in a Google Base from a web
> application written for Google Apps Engine but I'm not able to, due to
> problems with authentication. I'm using gdata-py-1.2.4 and GAE SDK
> 1.1.9.
>
> Here is a sample code of what I do:
>
> class MainPage(webapp.RequestHandler):
>     def get(self):
>         next_url = atom.url.Url('http', settings.HOST_NAME, path='/
> doit')
>
>         client = gdata.base.service.GBaseService()
>         gdata.alt.appengine.run_on_appengine(client)
>
>         get_token = client.GenerateAuthSubURL(next_url,
>                    ('http://www.google.com/base/',), secure= False,
> session=True)
>
>         self.response.out.write("""<html><body>
>         <a href="%s">Request token for the Google Base Scope</a>
>         </body></html>""" % get_token)
>
> class DoIt(webapp.RequestHandler):
>     def get(self):
>         client = gdata.base.service.GBaseService()
>         gdata.alt.appengine.run_on_appengine(client)
>         auth_token = gdata.auth.extract_auth_sub_token_from_url
> (self.request.uri)
>         session_token = client.upgrade_to_session_token(auth_token)
>
>         client.current_token = session_token
>
>         item = gdata.base.GBaseItem()
>         item.author.append(atom.Author(name=atom.Name(text='Mr.
> Smith')))
>         item.title = atom.Title(text='He Jingxian\'s chicken')
>         item.link.append(atom.Link(rel='alternate', link_type='text/
> html',href='http://www.host.com/123456jsh9'))
>         item.label.append(gdata.base.Label(text='kung pao chicken'))
>         item.item_type = gdata.base.ItemType(text='recipes')
>         item.AddItemAttribute(name='cooking_time', value='30 minutes')
>         item.AddItemAttribute(name='main_ingredient', value='chicken')
>
>         client.InsertItem(item)
>
> application = webapp.WSGIApplication([("/",MainPage),('/doit',DoIt)])
> def main():
>         run_wsgi_app(application)
> if __name__ == '__main__':
>         main()
>
> No matter what scope I specify in GenerateAuthSubURL(tried 
> withhttp://www.google.com/basehttp://www.google.com/base/feedshttp://www.google.com/base/feeds/itemshttp://base.google.com/and
>  so
> on)  when i try to insert an item by GETting /doit I get the following
> output in the console running the development web server:
>
> ERROR    2009-02-15 23:11:37,427 __init__.py] {'status': 401, 'body':
> '<HTML>\n<HEAD>\n<TITLE>Token invalid - AuthSub token has wrong scope</
> TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Token
> invalid - AuthSub token has wrong scope</H1>\n<H2>Error 401</H2>\n</
> BODY>\n</HTML>\n', 'reason': ''}
> Traceback (most recent call last):
>   File "/home/svetlin/gapps/google_appengine/google/appengine/ext/
> webapp/__init__.py", line 498, in __call__
>     handler.get(*groups)
>   File "/home/svetlin/gapps/watch_and_publish_web/
> watch_and_publish.py", line 115, in get
>     client.InsertItem(item)
>   File "/home/svetlin/gapps/watch_and_publish_web/gdata/base/
> service.py", line 172, in InsertItem
>     escape_params=escape_params, converter=converter)
>   File "/home/svetlin/gapps/watch_and_publish_web/gdata/service.py",
> line 1147, in Post
>     media_source=media_source, converter=converter)
>   File "/home/svetlin/gapps/watch_and_publish_web/gdata/service.py",
> line 1267, in PostOrPut
>     'reason': server_response.reason, 'body': result_body}
> RequestError: {'status': 401, 'body': '<HTML>\n<HEAD>\n<TITLE>Token
> invalid - AuthSub token has wrong scope</TITLE>\n</HEAD>\n<BODY
> BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Token invalid - AuthSub token
> has wrong scope</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n',
> 'reason': ''}
> INFO     2009-02-15 23:11:37,444 dev_appserver.py] "GET /doit?
> auth_sub_scopes=http%3A%2F%2Fwww.google.com%2Fbase&token=CIas7JLLGxCE-
> KP9_P____8B HTTP/1.1" 200 -
>
> Can someone let me know where the problem is cause I'm already very
> confused :)
> Thanks in Advance!
>
> Cheers,
> Svetlin Simonyan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Base Data API" 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-Base-data-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to