获取Google Fitness API步骤数

时间:2019-02-23 11:20:44

标签: google-api google-python-api

我正在尝试使用Python 3.7.2从Google Fitness API v1中获得的步骤数。我已经创建了一个服务帐户,可以执行此服务到服务的方式。 OAuth2ServiceAccount

from google.oauth2 import service_account
from googleapiclient.discovery import build

SCOPES = ['https://www.googleapis.com/auth/fitness.activity.read']
SERVICE_ACCOUNT_FILE = 'auth1.json'

credentials = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES)
service = build('fitness', 'v1', credentials=credentials)

print("dataSources().list")
print(service.users().dataSources().list(userId='me').execute())

我收到一个空的答复:

dataSources().list
{'dataSource': []}

我想念什么?

0 个答案:

没有答案