bimmerconnected / bimmer_connected

🚘 Library to query the status of your BMW or Mini from the ConnectedDrive portal
Apache License 2.0
365 stars 79 forks source link

Handle quota exceeded in HTTP 403 #543

Closed rikroe closed 1 year ago

rikroe commented 1 year ago

Proposed change

This PR updates our API client to handle not directly resolvable quota issues with a new exception (MyBMWQuotaError). Additional logic was needed, as sometimes this error not only occurs with HTTP status code 429, but also 403 Forbidden.

After this is merged, we can update the HA component to not require re-entering the password on quota issues (see

Type of change

Additional information

Checklist

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (b60fb7f) 100.00% compared to head (52a7c0a) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #543 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 18 18 Lines 1479 1483 +4 ========================================= + Hits 1479 1483 +4 ``` | Flag | Coverage Δ | | |---|---|---| | 3.10 | `100.00% <100.00%> (ø)` | | | 3.11 | `100.00% <100.00%> (ø)` | | | 3.7 | `100.00% <100.00%> (ø)` | | | 3.8 | `100.00% <100.00%> (ø)` | | | 3.9 | `100.00% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://app.codecov.io/gh/bimmerconnected/bimmer_connected/pull/543?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected) | Coverage Δ | | |---|---|---| | [bimmer\_connected/api/authentication.py](https://app.codecov.io/gh/bimmerconnected/bimmer_connected/pull/543?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected#diff-YmltbWVyX2Nvbm5lY3RlZC9hcGkvYXV0aGVudGljYXRpb24ucHk=) | `100.00% <100.00%> (ø)` | | | [bimmer\_connected/api/utils.py](https://app.codecov.io/gh/bimmerconnected/bimmer_connected/pull/543?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected#diff-YmltbWVyX2Nvbm5lY3RlZC9hcGkvdXRpbHMucHk=) | `100.00% <100.00%> (ø)` | | | [bimmer\_connected/models.py](https://app.codecov.io/gh/bimmerconnected/bimmer_connected/pull/543?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected#diff-YmltbWVyX2Nvbm5lY3RlZC9tb2RlbHMucHk=) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.