https://github.com/veerendra2/fitbit-cli
Access your Fitbit โ๏ธ data at your terminal ๐ป
https://github.com/veerendra2/fitbit-cli
cli fitbit fitbit-api pip python
Last synced: 9 days ago
JSON representation
Access your Fitbit โ๏ธ data at your terminal ๐ป
- Host: GitHub
- URL: https://github.com/veerendra2/fitbit-cli
- Owner: veerendra2
- License: mit
- Created: 2024-12-22T19:16:26.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-12-24T19:20:55.000Z (4 months ago)
- Last Synced: 2024-12-24T20:20:03.753Z (4 months ago)
- Topics: cli, fitbit, fitbit-api, pip, python
- Language: Python
- Homepage:
- Size: 219 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fitbit CLI
[](https://github.com/veerendra2/fitbit-cli/actions/workflows/release.yml) [
](https://pypi.org/project/fitbit-cli/) [
](https://pypi.org/project/fitbit-cli/)> This is not an official Fitbit CLI
Access your Fitbit data directly from your terminal ๐ป. View ๐ค sleep logs, โค๏ธ heart rate, ๐๏ธโโ๏ธ activity levels, ๐ฉธ SpO2, and more, all presented in a simple, easy-to-read table format!
![]()
[](https://asciinema.org/a/696114)
## Supported Web APIs
> Only `GET` APIs are supported!
| API | Status |
| ----------------------------------------------------------------------------------------------------------------------- | ------ |
| [User](https://dev.fitbit.com/build/reference/web-api/user/) | โ |
| [Sleep](https://dev.fitbit.com/build/reference/web-api/sleep/) | โ |
| [SpO2](https://dev.fitbit.com/build/reference/web-api/spo2/) | โ |
| [Heart Rate Time Series](https://dev.fitbit.com/build/reference/web-api/heartrate-timeseries/) | โ |
| [Active Zone Minutes (AZM) Time Series](https://dev.fitbit.com/build/reference/web-api/active-zone-minutes-timeseries/) | โ |
| [Activity](https://dev.fitbit.com/build/reference/web-api/activity/) | โ |## Usage Guide
1. Install the Fitbit CLI
```bash
python -m pip install fitbit-cli
```2. Help
```bash
fitbit-cli -h
usage: fitbit-cli [-h] [-i] [-s [DATE[,DATE]]] [-o [DATE[,DATE]]] [-e [DATE[,DATE]]] [-a [DATE[,DATE]]] [-u] [-v]Fitbit CLI -- Access your Fitbit data at your terminal.
options:
-h, --help show this help message and exit
-i, --init-auth Initialize Fitbit iterative authentication setup
-v, --version Show fitbit-cli versionAPIs:
Specify date ranges (ISO 8601 format: YYYY-MM-DD) for the following arguments.
You can provide a single date or a range (start,end). If not provided, defaults to today's date.-s, --sleep [DATE[,DATE]]
Show sleep data
-o, --spo2 [DATE[,DATE]]
Show SpO2 data
-e, --heart [DATE[,DATE]]
Show Heart Rate Time Series data
-a, --active-zone [DATE[,DATE]]
Show Active Zone Minutes (AZM) Time Series data
-u, --show-user-profile
Show user profile data
```3. Register Fitbit App
1. Go to [https://dev.fitbit.com/apps](https://dev.fitbit.com/apps)
2. Click on "REGISTER AN APP" tab
3. Follow below example and register an app
![]()
4. Run the following command to set up interactive authentication and store the Fitbit token locally
```bash
fitbit-cli --init-auth
```For a visual guide, see the Asciinema recording below
[](https://asciinema.org/a/696115)5. Start using it ๐
```bash
$ fitbit-cli -s
Sleep Data Summary ๐ด
โโโโโโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโ
โ Date ๐ โ Deep Sleep ๐ โ Light Sleep ๐ค โ REM Sleep ๐ โ Wake Time โฐ โ Efficiency ๐ฏ โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ 2024-12-25 โ 139 min โ 190 min โ 155 min โ 54 min โ 55% โ
โโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโ
```_**NOTE: The token is valid for only 8 hours, `fitbit-cli` automatically refreshes the token when it expires.**_
## Local Development
- [Fitbit Docs](https://dev.fitbit.com/build/reference/web-api/)
- [OAuth Tutorial](https://dev.fitbit.com/build/reference/web-api/troubleshooting-guide/oauth2-tutorial/)```bash
git clone [email protected]:veerendra2/fitbit-cli.git
cd fitbit-clipython -m venv venv
source venv/bin/activate
python -m pip install -e .
```