`pylibrelinkup` is a Python client for the LibreLinkUp API, which allows you to interact with the LibreLinkUp service to retrieve glucose data and other related information. This project is a Python implementation inspired by the [libre-link-up-api-client](https://github.com/DiaKEM/libre-link-up-api-client) project.
This pull request introduces several updates to the pylibrelinkup project, including enhancements to the read method, new exception handling, and additional test coverage. The most important changes are summarized below:
Enhancements to read Method:
Updated the read method to accept a patient_identifier parameter, which can be a UUID, str, or Patient object. Added validation to handle different types of identifiers. (src/pylibrelinkup/client.py)
Updated the README.md to reflect the changes in the read method, specifying that it now accepts a patient_identifier parameter. (README.md)
Exception Handling:
Added a new TermsOfUseError exception to handle cases where the user needs to accept terms of use. (src/pylibrelinkup/exceptions.py)
Modified the authenticate method to raise a TermsOfUseError when the user needs to accept terms of use. (src/pylibrelinkup/client.py)
Testing Improvements:
Added new test cases for the read method to cover various scenarios, including valid and invalid identifiers and unauthenticated clients. (tests/test_client_read.py)
Introduced fixtures and factory classes to simplify test setup and data generation. (tests/conftest.py, tests/factories.py) [1][2]
Added a test case to ensure the authenticate method raises a TermsOfUseError when appropriate. (tests/test_client_authentication.py)
Configuration Updates:
Updated the pyproject.toml to include setuptools-scm for dynamic versioning and added a [tool.setuptools_scm] section. (pyproject.toml) [1][2]
Workflow Adjustments:
Modified the GitHub Actions workflow to specify the tests directory when running pytest. (.github/workflows/python-package.yml)
This pull request introduces several updates to the
pylibrelinkup
project, including enhancements to theread
method, new exception handling, and additional test coverage. The most important changes are summarized below:Enhancements to
read
Method:read
method to accept apatient_identifier
parameter, which can be aUUID
,str
, orPatient
object. Added validation to handle different types of identifiers. (src/pylibrelinkup/client.py
)README.md
to reflect the changes in theread
method, specifying that it now accepts apatient_identifier
parameter. (README.md
)Exception Handling:
TermsOfUseError
exception to handle cases where the user needs to accept terms of use. (src/pylibrelinkup/exceptions.py
)authenticate
method to raise aTermsOfUseError
when the user needs to accept terms of use. (src/pylibrelinkup/client.py
)Testing Improvements:
read
method to cover various scenarios, including valid and invalid identifiers and unauthenticated clients. (tests/test_client_read.py
)tests/conftest.py
,tests/factories.py
) [1] [2]authenticate
method raises aTermsOfUseError
when appropriate. (tests/test_client_authentication.py
)Configuration Updates:
pyproject.toml
to includesetuptools-scm
for dynamic versioning and added a[tool.setuptools_scm]
section. (pyproject.toml
) [1] [2]Workflow Adjustments:
tests
directory when runningpytest
. (.github/workflows/python-package.yml
)