用Python检索Fitbit心率数据

2024-09-27 21:22:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在用Fitbit Python package来分析我的数据。当我查看我的运动数据时,它似乎非常有效:

fitbit_stats = authd_client._COLLECTION_RESOURCE('activities', date='2015-09-16')

但是,当我尝试获取我的心率数据时,它会运行,但除了0外不返回任何内容:

^{pr2}$

{'heart': [], 'average': [{'tracker': 'Resting Heart Rate', 'heartRate': 0}, {'tracker': 'Normal Heart Rate', 'heartRate': 0}, {'tracker': 'Exertive Heart Rate', 'heartRate': 0}]}

有人知道我为什么不在这里返回任何数据吗?在


Tags: 数据clientpackagedateratestatstrackerresource
1条回答
网友
1楼 · 发布于 2024-09-27 21:22:46

下面的方法会有用,但我不确定这是否是您要找的

fitbit_stats = authd_client._COLLECTION_RESOURCE('activities/heart', date='2016-08-11')
print fitbit_stats

我猜你想要一天中的约会(像我一样)

根据https://dev.fitbit.com/docs/heart-rate/#get-heart-rate-intraday-time-series

Access to the Intraday Time Series for personal use (accessing your own data) is available through the "Personal" App Type.

Access to the Intraday Time Series for all other uses is currently granted on a case-by-case basis. ...

我在fitbit api包中添加了一个自定义函数:

^{pr2}$

它将返回的数据如下所示:

'activities-heart-intraday': {
    'dataset': [
        {'time': '00:00:00', 'value': 66},
        {'time': '00:00:10', 'value': 67},
        {'time': '00:00:25', 'value': 67},
        {'time': '00:00:40', 'value': 67},

        {'time': '23:57:40', 'value': 84},
        {'time': '23:58:40', 'value': 85},
        {'time': '23:58:50', 'value': 80}
    ],
    'datasetInterval': 1,
    'datasetType': 'second'
}

相关问题 更多 >

    热门问题