fix: auto-chunk breathing rate and HRV date ranges > 30 days - #48
Draft
veerendra2 wants to merge 3 commits into
Draft
fix: auto-chunk breathing rate and HRV date ranges > 30 days#48veerendra2 wants to merge 3 commits into
veerendra2 wants to merge 3 commits into
Conversation
Owner
Author
|
Still failing, here is what I did pip3 install -e .
...
fitbit-cli -H last-2-months
Traceback (most recent call last):
File "/Users/veerendra/.local/pipx/venvs/fitbit-cli/lib/python3.14/site-packages/fitbit_cli/fitbit_api.py", line 62, in make_request
response.raise_for_status()
~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/Users/veerendra/.local/pipx/venvs/fitbit-cli/lib/python3.14/site-packages/requests/models.py", line 1028, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.fitbit.com/1/user/-/hrv/date/2026-05-28/2026-07-27.json
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/veerendra/.local/bin/fitbit-cli", line 6, in <module>
sys.exit(main())
~~~~^^
File "/Users/veerendra/.local/pipx/venvs/fitbit-cli/lib/python3.14/site-packages/fitbit_cli/main.py", line 35, in main
output.table_display(fitbit, args)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "/Users/veerendra/.local/pipx/venvs/fitbit-cli/lib/python3.14/site-packages/fitbit_cli/output.py", line 151, in table_display
fmt.display_hrv(fitbit.get_hrv_summary(*args.hrv))
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/Users/veerendra/.local/pipx/venvs/fitbit-cli/lib/python3.14/site-packages/fitbit_cli/fitbit_api.py", line 158, in get_hrv_summary
response = self.make_request("GET", url)
File "/Users/veerendra/.local/pipx/venvs/fitbit-cli/lib/python3.14/site-packages/fitbit_cli/fitbit_api.py", line 71, in make_request
raise FitbitAPIError(f"HTTP error occurred: {response.json()}") from e
fitbit_cli.exceptions.FitbitAPIError: HTTP error occurred: {'error': {'code': 400, 'message': 'Request contains an invalid argument.', 'status': 'INVALID_ARGUMENT'}}
|
Owner
Author
|
@veerendra2 Bumped version to Regarding the traceback: line 158 in your log shows: File ".../fitbit_cli/fitbit_api.py", line 158, in get_hrv_summary
response = self.make_request("GET", url)and URL
To test the PR changes locally, checkout the feature branch first: git fetch origin
git checkout fix/breathing-hrv-date-range
pip3 install -e .
fitbit-cli -H last-2-months |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fixes #35 by automatically splitting date ranges > 30 days into <= 30-day chunks for Breathing Rate and HRV endpoints.
Changes
How to Test
============================= test session starts ==============================
platform linux -- Python 3.13.5, pytest-9.1.1, pluggy-1.6.0
rootdir: /tmp/fitbit-cli
configfile: pyproject.toml
collected 4 items
tests/date_range_test.py .... [100%]
============================== 4 passed in 0.53s ===============================
2. Local execution with relative dates > 30 days: