raman325 / pytomorrowio

Async Python client for Tomorrow.io API
MIT License
2 stars 3 forks source link

Simple prototype to discover the time steps that an API key supports #32

Closed lymanepp closed 1 year ago

lymanepp commented 1 year ago

This is a simple prototype to discover the time steps that an API key supports. Due to the overhead of making a few API calls, this should probably be done one time only in the config_flow and saved in the config_entry.

The return value of this function is currently a list of valid time steps. It could instead be the smallest time step that worked--whichever value works better with the HA integration.

We could also discover which fields are supported by an API key using the same approach.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 85.81% and project coverage change: +1.73 :tada:

Comparison is base (267fc61) 85.18% compared to head (b6649fb) 86.92%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #32 +/- ## ========================================== + Coverage 85.18% 86.92% +1.73% ========================================== Files 7 7 Lines 324 390 +66 ========================================== + Hits 276 339 +63 - Misses 48 51 +3 ``` | [Impacted Files](https://app.codecov.io/gh/raman325/pytomorrowio/pull/32?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Raman+Gupta) | Coverage Δ | | |---|---|---| | [setup.py](https://app.codecov.io/gh/raman325/pytomorrowio/pull/32?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Raman+Gupta#diff-c2V0dXAucHk=) | `0.00% <ø> (ø)` | | | [pytomorrowio/pytomorrowio.py](https://app.codecov.io/gh/raman325/pytomorrowio/pull/32?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Raman+Gupta#diff-cHl0b21vcnJvd2lvL3B5dG9tb3Jyb3dpby5weQ==) | `86.16% <84.37%> (+2.72%)` | :arrow_up: | | [pytomorrowio/\_\_init\_\_.py](https://app.codecov.io/gh/raman325/pytomorrowio/pull/32?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Raman+Gupta#diff-cHl0b21vcnJvd2lvL19faW5pdF9fLnB5) | `100.00% <100.00%> (ø)` | | | [pytomorrowio/const.py](https://app.codecov.io/gh/raman325/pytomorrowio/pull/32?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Raman+Gupta#diff-cHl0b21vcnJvd2lvL2NvbnN0LnB5) | `92.17% <100.00%> (+0.20%)` | :arrow_up: | | [pytomorrowio/exceptions.py](https://app.codecov.io/gh/raman325/pytomorrowio/pull/32?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Raman+Gupta#diff-cHl0b21vcnJvd2lvL2V4Y2VwdGlvbnMucHk=) | `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.

lymanepp commented 1 year ago

I created a new free API token today for testing purposes. I found that:

  1. 60 minutes is the shortest time step--which seems to remove the nowcast functionality for new tokens.
  2. The documentation shows that the new token still supports 500 calls per day. I thought there were reports of tokens being limited to 100 calls per day.
  3. They removed the ratelimit response headers from free API tokens. I haven't looked to see if they grandfathered the old API tokens.

EDIT: I have verified that the ratelimit response headers aren't being returned for old or new API tokens.