I use Google APIs Client Library for Python to work with Fusion Tables API. importRows method here requires to provide the data in the body. How should I do it?
response = service.table().importRows(tableId=TABLE_ID, body='zzz,yyy').execute()
returns the error - Got an unexpected keyword argument "body"
.
There's a slight subtlety here -- the body of the request should be the
Table
resource, if you want to update it; the contents (in this case, the rows) should actually be passed as a media upload.In the python client, this means you want to pass something in to the
media_body
argument, notbody
. You can't just pass a literal string -- you need to wrap the data in either a MediaFileUpload or MediaInMemoryUpload. (For the case here, you want the latter, but if you've got a file with rows on disk, you want the former.)