0

I am trying to create a script Python script that allows me to both Read a Google Fusion Table and to import rows in to it. I have been working with the sample code found at https://developers.google.com/fusiontables/docs/samples/python to try and develop an understanding of how to work with fusion tables.

My problem is that the samples in here that involve making POST requests all result in a "400 Bad Request" being returned. GET requests work just fine though. As far as I can tell the requests follow the API style guide. Why would this be failing?

EDIT: Specifically the request returns:

400 Bad Request
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "parseError",
    "message": "Parse Error"
   }
  ],
  "code": 400,
  "message": "Parse Error"
 }
}
Tiberius
  • 15
  • 1
  • 5
  • The httplib API is really awkward. You'd do better to use the library called requests http://docs.python-requests.org/en/latest/user/quickstart/#more-complicated-post-requests – Colonel Panic Mar 12 '13 at 20:26
  • @ColonelPanic, by 'broken' do you simply mean httplib is not as convenient to use in some situations as Requests? Or are you suggesting switching to Requests will fix the problem, that somehow using httplib is causing the 400 code? – jimhark Mar 12 '13 at 20:31
  • I switched to using requests but my POST requests still don't work however now I am getting a 404 not found error. – Tiberius Mar 14 '13 at 17:58
  • The problem is in how query is written in the code. The whole query "stuff/%s/morestuff" %tableid causes a parse error. The error doesn't seem to matter what library you are using either. – Tiberius Mar 15 '13 at 00:37

0 Answers0