`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.
MIT License
2
stars
0
forks
source link
Handle the case where the user's email requires verification #29
This pull request adds support for the login response which indicates that the user's email address requires verification. It introduces a new base exception class PyLibreLinkUpError and refactors existing exceptions to inherit from it. Additionally, a new exception EmailVerificationError is added to handle email verification errors. Corresponding changes are made to the authentication logic and tests to accommodate this new exception.
Refactoring and New Exception:
Introduced PyLibreLinkUpError as a base class for all custom exceptions in the pylibrelinkup module. (src/pylibrelinkup/exceptions.py)
Added a new exception EmailVerificationError to handle scenarios where the user needs to verify their email. (src/pylibrelinkup/exceptions.py)
Authentication Logic Update:
Updated the authenticate method to raise EmailVerificationError when the authentication response indicates that email verification is required. (src/pylibrelinkup/pylibrelinkup.py)
Test Enhancements:
Added a new test fixture email_verification_response_json to provide mock data for email verification responses. (tests/conftest.py)
Created a new test case to ensure the authenticate method raises EmailVerificationError when appropriate. (tests/test_client_authentication.py)
Added a new JSON file email_verification_response.json containing mock data for email verification responses. (tests/data/email_verification_response.json)
This pull request adds support for the login response which indicates that the user's email address requires verification. It introduces a new base exception class
PyLibreLinkUpError
and refactors existing exceptions to inherit from it. Additionally, a new exceptionEmailVerificationError
is added to handle email verification errors. Corresponding changes are made to the authentication logic and tests to accommodate this new exception.Refactoring and New Exception:
PyLibreLinkUpError
as a base class for all custom exceptions in thepylibrelinkup
module. (src/pylibrelinkup/exceptions.py
)EmailVerificationError
to handle scenarios where the user needs to verify their email. (src/pylibrelinkup/exceptions.py
)Authentication Logic Update:
authenticate
method to raiseEmailVerificationError
when the authentication response indicates that email verification is required. (src/pylibrelinkup/pylibrelinkup.py
)Test Enhancements:
email_verification_response_json
to provide mock data for email verification responses. (tests/conftest.py
)authenticate
method raisesEmailVerificationError
when appropriate. (tests/test_client_authentication.py
)email_verification_response.json
containing mock data for email verification responses. (tests/data/email_verification_response.json
)