问题
Background Info
I am Using python
gdata
spreadsheet-api
with OAuth2.0
and certificate credentials
to access data in a google apps domain
I am trying to insert a row into a spreadsheet using
spreadSheetClient = SpreadsheetsClient()
# Certificate Authentication ....
spreadSheetClient.add_list_entry(list_entry=list_entry, spreadsheet_key=spreadSheetKey,
worksheet_id=workSheetId)
where list_entry
is an instance of gdata.spreadsheets.data.ListEntry
and spreadsheetKey
and worksheetId
are instances of str
I am getting the following error
File "/home/gautam/Projects/osflow/build/runtime/gdata/spreadsheets/client.py", line 450, in update_cell
**kwargs)
File "/home/gautam/Projects/osflow/build/runtime/gdata/client.py", line 730, in update
desired_class=entry.__class__, **kwargs)
File "/home/gautam/Projects/osflow/build/runtime/gdata/client.py", line 319, in request
RequestError)
RequestError: Server responded with: 403, If-Match or If-None-Match header or entry etag attribute required
How do I fix this ?
回答1:
ListFeed appends rows, rather than inserts them and columns want a column header (I think the header is required).
For an example of how to use list feed, look at http://gdata-java-client.googlecode.com/svn-history/r51/trunk/java/sample/spreadsheet/list/ListDemo.java
I have not used list feed that often, but it feels very much like using SQL, where you filter/append etc. I tend to use Cell Feed instead.
来源:https://stackoverflow.com/questions/20270565/403-if-match-or-if-none-match-header-or-entry-etag-attribute-required