service = build(“fusiontables”,“v1”,http = http)无法运行

时间:2012-06-20 20:06:06

标签: python google-fusion-tables google-api-python-client

我正在使用通用google-api-python-client来访问Fusion Tables API,并且不能对它做任何有用的事情。

好吧,我已经阅读过函数帮助:

service = build("fusiontables", "v1")
help(service)

得到了这个:

class Resource(__builtin__.object)
 |  A class for interacting with a resource.
 |  
 |  Methods defined here:
 |  
 |  __init__(self)
 |  
 |  column = methodResource(self)
 |      A collection resource.
 |  
 |  query = methodResource(self)
 |      A collection resource.
 |  
 |  style = methodResource(self)
 |      A collection resource.
 |  
 |  table = methodResource(self)
 |      A collection resource.
 |  
 |  template = methodResource(self)
 |      A collection resource.

但它仍然没有给我任何东西。

我已尝试过sample

中的代码
f = file('key.p12', 'rb')
key = f.read()
f.close()

credentials = SignedJwtAssertionCredentials(
    '...',
    key,
    scope='https://www.googleapis.com/auth/fusiontables')
http = httplib2.Http()
http = credentials.authorize(http)

service = build("fusiontables", "v1", http=http)
print(service.table().list().execute())

它给了我“{u'kind':u'fusiontables#tableList'}”。

但是我仍然没有得到它如何运行SQL查询,如何向表中插入行? 你能解释那一刻吗?

1 个答案:

答案 0 :(得分:1)

有一个更简单的Fusion Table Client python代码:http://code.google.com/p/fusion-tables-client-python/我成功地使用了它。