greenscar / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
0 stars 0 forks source link

InsertRow gives 400 bad request #481

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
 steps will reproduce the problem [I am on a mac]
1. Using a google app account, by setting gd_client.domain = xyz.com
2.Using the same example ListInsertAction as provided in the example.

The data should be inserted in the spreadsheet but I see  {'status': 400, 
'body': 'Invalid query parameter value for grid-id.', 'reason': 'Bad Request'}

Original issue reported on code.google.com by abhishek...@gmail.com on 23 Dec 2010 at 6:21

GoogleCodeExporter commented 9 years ago
Can you provide sample code that replicates this problem?

Original comment by joe.gregorio@gmail.com on 20 Jan 2011 at 8:08

GoogleCodeExporter commented 9 years ago
This appears eerily similar to a problem I reported a couple of days ago on 
apps-api-issues (Issue 2381); it's possible that it's an issue with the Python 
client, but I don't think so, since it works with non-Hosted—i.e., 
Google—accounts.

That issue (and the steps required to reproduce it) are posted here:

  http://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=2381

Sample code is fairly simple: it can be reproduced using the unmodified sample 
code bundled with the gdata Python client.

Original comment by jerome%a...@gtempaccount.com on 21 Jan 2011 at 3:45

GoogleCodeExporter commented 9 years ago
This is an issue with the Apps API.

Original comment by joe.gregorio@gmail.com on 7 Mar 2011 at 3:22

GoogleCodeExporter commented 9 years ago
Hi Joe,
is there a bug open against the Apps API? Can you reference it here, please?

Cause this closed... but I have no visibility on the issue... is it being fixed?

regards,
G.

p.s. my code, if you want to reproduce...
http://bazaar.launchpad.net/~zeph1ro/berliner/trunk/view/head:/berliner/gdatalib
.py

guserra@4DEL06116:~/tmp/berliner$ ./y_fetch|./g_write 
('EURUSD=X', '1.4441')
('EURCHF=X', '1.2941')
('EURGBP=X', '0.8878')
 - username: guido.serra
 - password: 

gdata.service.RequestError: {'status': 400, 'body': 'We're sorry, a server 
error occurred. Please wait a bit and try reloading your spreadsheet.', 
'reason': 'Bad Request'}

Original comment by guido.se...@gmail.com on 14 Apr 2011 at 8:57

GoogleCodeExporter commented 9 years ago
Same error trying to insert a row into spreadsheet using gdata.  Code similar 
to that listed in earlier examples. 

Original comment by enab...@gmail.com on 20 Apr 2011 at 2:55

GoogleCodeExporter commented 9 years ago
can you set gd_client.debug = True and paste the HTTP output you get when 
reproducing the 400?

Original comment by vicfry...@google.com on 27 Apr 2011 at 7:09

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
sure, here you go...
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

grinder:berliner zeph$ ./y_fetch|./g_write 
('EURUSD=X', '1.4773')
('EURCHF=X', '1.2938')
('EURGBP=X', '0.8885')
 - username: #######me#######
 - password: 
send: 'POST https://www.google.com/accounts/ClientLogin 
HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: 
www.google.com\r\nContent-Length: 88\r\nContent-Type: 
application/x-www-form-urlencoded\r\n\r\n'
send: 
'Passwd=#########&source=None&service=wise&Email=#######me#######&accountType=HO
STED_OR_GOOGLE'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Type: text/plain
header: Cache-control: no-cache, no-store
header: Pragma: no-cache
header: Expires: Mon, 01-Jan-1990 00:00:00 GMT
header: Date: Thu, 28 Apr 2011 17:03:22 GMT
header: X-Content-Type-Options: nosniff
header: X-XSS-Protection: 1; mode=block
header: Content-Length: 755
header: Server: GSE
send: 'POST 
https://spreadsheets.google.com/feeds/worksheets/0AswUaQ1cS3dDdG8yTk8yWjNzUVktRH
I0OXUwRTBBemc/private/full HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: 
spreadsheets.google.com\r\nContent-Length: 307\r\nContent-Type: 
application/atom+xml\r\nAuthorization: GoogleLogin 
auth=################\r\nUser-Agent: None GData-Python/2.0.14\r\n\r\n'
send: '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<ns0:entry 
xmlns:ns0="http://www.w3.org/2005/Atom"><ns1:rowCount 
xmlns:ns1="http://schemas.google.com/spreadsheets/2006">3</ns1:rowCount><ns0:tit
le>2011-04-28</ns0:title><ns1:colCount 
xmlns:ns1="http://schemas.google.com/spreadsheets/2006">2</ns1:colCount></ns0:en
try>'
reply: 'HTTP/1.1 201 Created\r\n'
header: Content-Type: application/atom+xml; charset=UTF-8
header: Expires: Thu, 28 Apr 2011 17:03:23 GMT
header: Date: Thu, 28 Apr 2011 17:03:23 GMT
header: Cache-Control: private, max-age=0, must-revalidate, no-transform
header: Vary: Accept, X-GData-Authorization, GData-Version
header: GData-Version: 1.0
header: Location: 
https://spreadsheets.google.com/feeds/worksheets/0AswUaQ1cS3dDdG8yTk8yWjNzUVktRH
I0OXUwRTBBemc/private/full/ocs/0
header: Content-Location: 
https://spreadsheets.google.com/feeds/worksheets/0AswUaQ1cS3dDdG8yTk8yWjNzUVktRH
I0OXUwRTBBemc/private/full/ocs/0
header: X-Content-Type-Options: nosniff
header: X-Frame-Options: SAMEORIGIN
header: X-XSS-Protection: 1; mode=block
header: Server: GSE
header: Transfer-Encoding: chunked
{'value': '1.2938', 'trade': 'EURCHF=X'}
send: 'POST 
https://spreadsheets.google.com/feeds/list/0AswUaQ1cS3dDdG8yTk8yWjNzUVktRHI0OXUw
RTBBemc/ocs/private/full HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: 
spreadsheets.google.com\r\nContent-Length: 292\r\nContent-Type: 
application/atom+xml\r\nAuthorization: GoogleLogin 
auth=#####################\r\nUser-Agent: None GData-Python/2.0.14\r\n\r\n'
send: '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<ns0:entry 
xmlns:ns0="http://www.w3.org/2005/Atom"><ns1:value 
xmlns:ns1="http://schemas.google.com/spreadsheets/2006/extended">1.2938</ns1:val
ue><ns1:trade 
xmlns:ns1="http://schemas.google.com/spreadsheets/2006/extended">EURCHF=X</ns1:t
rade></ns0:entry>'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Content-Type: text/html; charset=UTF-8
header: Date: Thu, 28 Apr 2011 17:03:24 GMT
header: Expires: Thu, 28 Apr 2011 17:03:24 GMT
header: Cache-Control: private, max-age=0
header: X-Content-Type-Options: nosniff
header: X-Frame-Options: SAMEORIGIN
header: X-XSS-Protection: 1; mode=block
header: Server: GSE
header: Transfer-Encoding: chunked
Traceback (most recent call last):
  File "./g_write", line 23, in <module>
    status = not main(sys.argv)
  File "./g_write", line 19, in main
    excel.write(data)
  File "/Users/zeph/tmp/berliner/berliner/gdatalib.py", line 57, in write
    entry = self.gd_client.InsertRow(trow, self.curr_key, curr_wksht_id)
  File "/Users/zeph/tmp/berliner/gdata/spreadsheet/service.py", line 339, in InsertRow
    converter=gdata.spreadsheet.SpreadsheetsListFromString)
  File "/Users/zeph/tmp/berliner/gdata/service.py", line 1236, in Post
    media_source=media_source, converter=converter)
  File "/Users/zeph/tmp/berliner/gdata/service.py", line 1358, in PostOrPut
    'reason': server_response.reason, 'body': result_body}
gdata.service.RequestError: {'status': 400, 'body': 'We're sorry, a server 
error occurred. Please wait a bit and try reloading your spreadsheet.', 
'reason': 'Bad Request'}

Original comment by guido.se...@gmail.com on 28 Apr 2011 at 5:06

GoogleCodeExporter commented 9 years ago
p.s. the code is here, if you want to play ;-)

http://bazaar.launchpad.net/~zeph1ro/berliner/trunk/revision/25

Original comment by guido.se...@gmail.com on 28 Apr 2011 at 5:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I was running into this problem but it turned out to be the uppercase column 
name problem discussed here: 
http://code.google.com/p/gdata-python-client/issues/detail?id=363#c2  Changing 
to lowercase column names worked for me.

Original comment by cle...@bucknell.edu on 20 May 2011 at 2:41

GoogleCodeExporter commented 9 years ago
hi, there are no upper case column names involved in my scenario... 

   Existing document >  I create a new worksheet > I create the row

column names are "trade" and "value", in lower case

Original comment by guido.se...@gmail.com on 20 May 2011 at 3:31

GoogleCodeExporter commented 9 years ago
Just wanted to report that I found the solution.

This bug only seems to occur with *blank* spreadsheets.  If I go into the 
spreadsheet via the web UI, and add the header columns manually -- then I'm 
able to successfully add the data using gdata.

I had been creating a blank spreadsheet using the instructions here:
http://code.google.com/apis/documents/docs/1.0/developers_guide_python.html#Crea
tingAnEmptyDocument

The trick to make this work, is to add the header row first with the "Cell 
Based Feed" api:
http://code.google.com/apis/spreadsheets/data/1.0/developers_guide_python.html#u
pdateCell

Then, use the Row api to add the rest of your data.  Works like a charm! :-)

Original comment by erikwick...@gmail.com on 25 May 2011 at 10:53

GoogleCodeExporter commented 9 years ago
thanks Erik, i have been struggling with the same problem

Original comment by commonze...@gmail.com on 31 May 2011 at 11:22

GoogleCodeExporter commented 9 years ago

Original comment by afs...@google.com on 7 Oct 2011 at 12:21

GoogleCodeExporter commented 9 years ago
any plans on fixing this? 

Original comment by spo...@gmail.com on 7 Feb 2012 at 11:17

GoogleCodeExporter commented 9 years ago
I found that server returns 400 when there are ^[a..z] in column names
even _ problematic..
Seems an XML issue

Original comment by novojilo...@gmail.com on 14 Aug 2013 at 6:33

GoogleCodeExporter commented 9 years ago
Thank you erickwick!!

Original comment by PaulCati...@gmail.com on 9 Oct 2013 at 9:55

GoogleCodeExporter commented 9 years ago
Is this issue going to ever get fixed?

Original comment by mkhan1...@gmail.com on 8 Jan 2015 at 1:28