有人可以幫助我從App Engine應用程序訪問大型查詢嗎?從App Engine應用程序訪問大型查詢表的無效憑證
我已經完成以下步驟 -
創建一個App Engine項目。
在/ lib中安裝了google-api-client,oauth2client依賴項(etc)。
通過雲控制檯爲App Engine項目啓用Big Query API。
創建了一些'Application Default Credentials'('Service Account Key')[JSON]並將其保存到App Engine應用程序的根目錄。
創建一個「大查詢服務資源」按以下 -
def get_bigquery_service():
from googleapiclient.discovery import build
from oauth2client.client import GoogleCredentials
credentials=GoogleCredentials.get_application_default()
bigquery_service=build('bigquery', 'v2', credentials=credentials)
return bigquery_service
驗證了資源存在 -
<googleapiclient.discovery.Resource object at 0x7fe758496090>
試着用以下的(專案編號來查詢資源是短App Engine應用程序的名稱) -
bigquery=get_bigquery_service()
bigquery.tables().list(projectId=#{ProjectId},
datasetId=#{DatasetId}).execute()
返回以下內容 -
<HttpError 401 when requesting https://www.googleapis.com/bigquery/v2/projects/#{ProjectId}/datasets/#{DatasetId}/tables?alt=json returned "Invalid Credentials">
任何關於步驟的想法我可能有錯誤或在這裏失蹤?整個AUTH過程似乎是一場噩夢,相當在與App Engine的/ PaaS的易用性,使用精神:-(
賠率謝謝。