python - importRows Google Fusion Tables API -


i import rows csv file fusion table using google fusion tables api, read this reference, don't understand how post csv file here: https://www.googleapis.com/upload/fusiontables/v1/tables/---tableid---/import

how should attach myfile.csv request in python ?

request = urllib2.request("https://www.googleapis.com/fusiontables/v1/tables/---tableid---/import") request.get_method = lambda: 'post' response = opener.open(request).read() 

what have:

opener = urllib2.build_opener(urllib2.httphandler) request = urllib2.request('https://www.googleapis.com/fusiontables/v1/query?%s' % \ (urllib.urlencode({'access_token': access_token,                    'sql': query})), headers={'content-length':0}) request.get_method = lambda: 'post'  response = opener.open(request).read() print response 

this code adds single rows fusion table using simple sql queries, need add 100k rows, according this reference have use importrows method , not sql insert statements.

thank you.

according documentation correct url import rows is

https://www.googleapis.com/upload/fusiontables/v1/tables/tableid/import 

importing rows table

to import more rows existing table, send authenticated post http request following uri (note upload in uri below):

https://www.googleapis.com/upload/fusiontables/v1/tables/tableid/import

you must supply row data in message body. row data should csv formatted data, though may specify alternative delimiters.

probably this example can somehow.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -