Can you supply the raw xml being submitted and received ?
6/3/10 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 Jul 7, 7:17 pm, CP <chris.cpdigi...@gmail.com> wrote: > Hi, > > I've updated the code & the codeis running properly till I use the > insert command. It's showing the same error above. I tried all > possible solution given in this forum, but it's not working. Can > anybody help. I'm putting the updated code below. > > import gdata.base.service > import gdata.service > import atom > import gdata.base > gb_client = gdata.base.service.GBaseService() > gb_client.email = raw_input('Please enter your username: ') > gb_client.password = raw_input('Please enter your password: ') > print 'Logged in' > gb_client.ProgrammaticLogin() > item = gdata.base.GBaseItem() > item.author.append(atom.Author(name=atom.Name(text='Chris'))) > item.title = atom.Title(text='Cobra S2 Offset') > item.link.append(atom.Link(rel='alternate', link_type='text/ > html', > href='http://www.google.com/feeds/item')) > item.label.append(gdata.base.Label(text='Golf Driver')) > item.item_type = gdata.base.ItemType(text='products') > item.AddItemAttribute(name='Cobra S2 Offset', value='1') > result = gb_client.InsertItem(item) > insertion_time = result.published.text > my_entry_id = result.id.text > > On Jul 7, 12:10 am, CP <chris.cpdigi...@gmail.com> wrote: > > > > > Hi, > > > I was trying to insert my product using Google Base API Python client > > library. The code that I used is the following: > > > "import gdata.base.service > > import gdata.service > > try: > > from xml.etree import ElementTree > > except ImportError: > > from elementtree import ElementTree > > import atom > > import gdata.base > > gb_client = gdata.base.service.GBaseService() > > gb_client.email = raw_input('Please enter your username: ') > > gb_client.password = raw_input('Please enter your password: ') > > print 'Logging in' > > gb_client.ProgrammaticLogin() > > item = gdata.base.GBaseItem() > > item.author.append(atom.Author(name=atom.Name(text='Chris Parker'))) > > item.title = atom.Title(text='Cobra S2 Offset') > > item.link.append(atom.Link(rel='alternate', link_type='text/ > > html', > > href='http://www.google.com/items/products/ > > 90uil9qgi8ofcfinjd8cul3vq0')) > > item.label.append(gdata.base.Label(text='Golf Driver')) > > item.item_type = gdata.base.ItemType(text='products') > > item.AddItemAttribute(name='drivers', value='1') > > result = gb_client.InsertItem(item, url_params={'dry-run': 'true'}) > > insertion_time = result.published.text" > > > But I'm getting the following error: > > > "Traceback (most recent call last): > > File "C:/Python26/google_base.py", line 22, in <module> > > result = gb_client.InsertItem(item, url_params={'dry-run': > > 'true'}) > > File "C:\Python26\lib\gdata\base\service.py", line 172, in > > InsertItem > > escape_params=escape_params, converter=converter) > > File "C:\Python26\lib\gdata\service.py", line 1236, in Post > > media_source=media_source, converter=converter) > > File "C:\Python26\lib\gdata\service.py", line 1357, in PostOrPut > > 'reason': server_response.reason, 'body': result_body} > > RequestError: {'status': 404, 'body': '<html><head><title>Error</title> > > \n<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> > > \n<script type="text/javascript">\n(function(){function a(d) > > {this.t={};this.tick=function(e,f,b){b=b?b:(new > > Date).getTime();this.t[e]=[b,f]};this.tick("start",null,d)}var c=new > > a;window.jstiming={Timer:a,load:c};try{var > > g=null;if(window.chrome&&window.chrome.csi)g=Math.floor(window.chrome.csi() > > .pageT);if(g==null)if(window.gtbExternal)g=window.gtbExternal.pageT();if(g= > > =null)if(window.external)g=window.external.pageT;if(g)window.jstiming.pt=g} > > catch(h){};})();\n\n</script>\n<script type="text/javascript" src="/ > > base/resource/3279009570-tail_bin.js"></script>\n\n<link > > rel="stylesheet" type="text/css" href="/base/styles/gb.css">\n<script > > type="text/javascript" src="/base/googlebasejs/2500138738- > > googlebasejs.js"></script>\n\n</head>\n<body><script type="text/ > > javascript">\n var _gaq = _gaq || [];\n > > _gaq.push([\'_setAccount\', "UA-18035-8"]);\n > > _gaq.push([\'_setDomainName\', \'none\']);\n > > _gaq.push([\'_setAllowLinker\', true]);\n > > _gaq.push([\'_trackPageview\']);\n\n (function() {\n var > > ga = document.createElement(\'script\'); ga.type = \'text/javascript > > \'; ga.async = true;\n ga.src = (\'https:\' == > > document.location.protocol ? \'https://ssl\' : \'http://www\') + > > \'.google-analytics.com/ga.js\';\n var s = > > document.getElementsByTagName(\'script\')[0]; > > s.parentNode.insertBefore(ga, s);\n })();\n </script>\n<div > > id="header-top-section"><div id="gaia-links"><a href="http:// > > base.google.com/support/?hl=en_US" target="new">Help</a> | <a href="/ > > base/welcome">Sign in</a></div>\n<h1><a href="/base/"><img > > src="http://www.google.com/images/logos/base_logo.gif" alt="Google > > Base"></a></h1> > > \n<div class="decoration-corners page-title"><div class="tl"><div > > class="tr"><div class="bl"><div class="br"><div class="decoration- > > content" id="page-title"><strong>Oops...</strong></div></div></div></ > > div></div></div>\n<div class="alert-message-section" title="null"> > > \n<div id="alertMessagePlaceholder" style="display:block"> </ > > div></div>\n\n<br class="clear"></div>\n\n\n<div class="maximize"><div > > id="light-frame"><div class="error-page"><h3>Oops...</h3>\n<div > > class="error-message">We didn't understand that.</div>\n<div > > class="error-message">You have tried to access a non-existent page.</ > > div>\n<div class="outlink"><a href="http://www.google.com/">Google > > Homepage</a></div></div></div></div>\n<div id="footer">© 2010 > > Google Inc.\n-\n<a href="/base/">Google Base Home</a> - <a > > href="http://www.google.com/privacy.html">Privacy Policy</a> - <a > > href="http://base.google.com/support/bin/answer.py? > > hl=en_US&answer=61118">Program Policies</a> - <a > > href="http://www.google.com/">Google Home</a></div>\n</body></html>\n<script > > type="text/javascript"> var loadTimer = window.jstiming.load; > > \nloadTimer.name = "items_post";\nloadTimer.tick("plt");\nif > > (window.jstiming.report) > > {\nwindow.jstiming.report(window.jstiming.load);\n}</script>', > > 'reason': 'Not Found'}" > > > I saw this error in wiki section of Google base python. Can anybody > > help me to figure out why this error I'm getting. > > > Regards, > > CP -- 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 google-base-data-...@googlegroups.com. To unsubscribe from this group, send email to google-base-data-api+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-base-data-api?hl=en.