Googleapi客户python适合api
Googleapiclient python fit api
是否有googleapi客户端示例或文档google适合
我找不到任何关于 google fit api for python 的文档
我找到的所有示例都是针对 google 驱动器的
喜欢
import googleapiclient.discovery
drive = googleapiclient.discovery.build(
API_SERVICE_NAME, API_VERSION, credentials=credentials)
files = drive.files().list().execute()
您那里的代码不会很好地工作,因为它似乎与 Google 驱动器有关。
def retrieve_data():
"""
Run through the OAuth flow and retrieve credentials.
Returns a dataset (Users.dataSources.datasets):
https://developers.google.com/fit/rest/v1/reference/users/dataSources/datasets
"""
flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE, REDIRECT_URI)
authorize_url = flow.step1_get_authorize_url()
print 'Go to the following link in your browser:'
print authorize_url
code = raw_input('Enter verification code: ').strip()
credentials = flow.step2_exchange(code)
# Create an httplib2.Http object and authorize it with our credentials
http = httplib2.Http()
http = credentials.authorize(http)
fitness_service = build('fitness', 'v1', http=http)
return fitness_service.users().dataSources(). \
datasets(). \
get(userId='me', dataSourceId=DATA_SOURCE, datasetId=DATA_SET). \
execute()
查看此文件以获取完整代码Getfit.py并确保正确设置重定向 URI
是否有googleapi客户端示例或文档google适合 我找不到任何关于 google fit api for python 的文档 我找到的所有示例都是针对 google 驱动器的 喜欢
import googleapiclient.discovery
drive = googleapiclient.discovery.build(
API_SERVICE_NAME, API_VERSION, credentials=credentials)
files = drive.files().list().execute()
您那里的代码不会很好地工作,因为它似乎与 Google 驱动器有关。
def retrieve_data():
"""
Run through the OAuth flow and retrieve credentials.
Returns a dataset (Users.dataSources.datasets):
https://developers.google.com/fit/rest/v1/reference/users/dataSources/datasets
"""
flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE, REDIRECT_URI)
authorize_url = flow.step1_get_authorize_url()
print 'Go to the following link in your browser:'
print authorize_url
code = raw_input('Enter verification code: ').strip()
credentials = flow.step2_exchange(code)
# Create an httplib2.Http object and authorize it with our credentials
http = httplib2.Http()
http = credentials.authorize(http)
fitness_service = build('fitness', 'v1', http=http)
return fitness_service.users().dataSources(). \
datasets(). \
get(userId='me', dataSourceId=DATA_SOURCE, datasetId=DATA_SET). \
execute()
查看此文件以获取完整代码Getfit.py并确保正确设置重定向 URI