使用 RefreshToken 在 Fusion Tables 中插入数据

Insert data in Fusion Tables using RefreshToken

我找不到此信息,我可以从 Google Fusion Table 获取数据,但我无法在没有传递访问令牌的情况下更新 table。 Google 文档很乱,很难找到这些信息,Python 代码示例已过时。

requests.post(url_api, params={'access_token': <access_token>, 
sql': "INSERT INTO " +  table_id + " (address) VALUES ('Test text')",
'key': fusion_api})

我收到 401 错误,我正在使用刷新令牌从 Google OAuth API 获取访问令牌。

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "authError",
    "message": "Invalid Credentials",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Invalid Credentials"
 }
}

我通过 Google 检查了我的令牌 API :

{
 "issued_to": "XXXX.apps.googleusercontent.com",
 "audience": "XXXX.apps.googleusercontent.com",
 "scope": "https://www.googleapis.com/auth/fusiontables",
 "expires_in": 3600,
 "access_type": "offline"
}

访问类型是否与此有关?

我已经通过删除参数中的 fusion_api 键解决了这个问题:

headers = {'Authorization': bearer_str ,'Content-Type': 'application/json', 'Host': 'www.googleapis.com'}
params = {
    'sql':"SELECT * FROM " + table_id,
    'key': fusion_api
}

headers = {'Authorization': bearer_str ,'Content-Type': 'application/json', 'Host': 'www.googleapis.com'}
params = {
    'sql':"SELECT * FROM " + table_id
}