Я использую this python library из Google, но я не могу понять, что использовать для аргумента 'body'. Есть ли пример тела, из которого я могу рисовать, чтобы создать dict, чтобы этот инструмент понадобился?Google подходит данные через библиотеки api google python
Вот код, который я использую:
flow = client.flow_from_clientsecrets(
workLaptop,
scope='https://www.googleapis.com/auth/fitness.activity.read',
redirect_uri='oauth:code:from:somehwere')
auth_uri = flow.step1_get_authorize_url()
webbrowser.open_new(auth_uri)
auth_code = "a;ldskjfa;lsdkfja;ldsfkja;lsdkfjaldgha;"
credentials = flow.step2_exchange(auth_code)
http_auth = credentials.authorize(httplib2.Http())
service = discovery.build('fitness', 'v1',http_auth)
fitData = service.users().dataset().aggregate(userId='me',body=body).execute()
Это все хорошо до той части, где мне нужно, чтобы определить тело. Вот тело, которое я пытаюсь:
body = {
"aggregateBy": [
{
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:estimated_steps",
"dataTypeName": "com.google.step_count.delta"
},
],
"bucketByActivitySegment": {
"minDurationMillis": "A String", # Only activity segments of duration longer than this is used
},
"endTimeMillis": "1435269600000000000",
"bucketBySession": {
"minDurationMillis": "10", # Only sessions of duration longer than this is used
},
"bucketByActivityType": {
"minDurationMillis": "10", # Only activity segments of duration longer than this is used
},
"startTimeMillis": "1435183200000000000", # required time range
"bucketByTime": { # apparently oneof is not supported by reduced_nano_proto
"durationMillis": "10",
},
}
Что не так с моим телом? Вот код ошибки: https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate?alt=json вернулся «Внутренняя ошибка»>
Вот пример объекта в Исследователь API:
Вот ссылка для проводника API: https://developers.google.com/apis-explorer/?hl=ru_RU/p}/fitness/v1/fitness. user.dataset.aggregate? userId = me Это позволит вам «обрабатывать» тело dict с помощью инструмента, но я не могу найти комбинацию, которая будет возвращать значения. – billmanH