raman325 / pytomorrowio

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

Consider partial content HTTP status as successful #24

Closed lymanepp closed 2 years ago

lymanepp commented 2 years ago

This resolves https://github.com/home-assistant/core/issues/75465 locally for me.

codecov-commenter commented 2 years ago

Codecov Report

Merging #24 (9ce2743) into master (267fc61) will increase coverage by 3.51%. The diff coverage is 91.66%.

@@            Coverage Diff             @@
##           master      #24      +/-   ##
==========================================
+ Coverage   85.18%   88.70%   +3.51%     
==========================================
  Files           7        7              
  Lines         324      354      +30     
==========================================
+ Hits          276      314      +38     
+ Misses         48       40       -8     
Impacted Files Coverage Δ
setup.py 0.00% <ø> (ø)
pytomorrowio/pytomorrowio.py 89.79% <91.20%> (+6.36%) :arrow_up:
pytomorrowio/__init__.py 100.00% <100.00%> (ø)
pytomorrowio/const.py 92.17% <100.00%> (+0.20%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d8407d8...9ce2743. Read the comment docs.

lymanepp commented 2 years ago

I sent a tomorrow.io support request with the following message

It looks like the V4 API started returning status code 206 today which is a breaking change for our application. We can obviously change our application to handle that, but I don't see any documentation regarding this change. It would be great if we could register to receive notification of API changes before they happen to avoid breaking our application in the real world.

GSzabados commented 2 years ago

I just bumped manually pytomorrowio to 0.3.4 and it does not solve the issue.

2022-07-20 15:40:53 INFO (SyncWorker_2) [homeassistant.util.package] Attempting install of pytomorrowio==0.3.4
2022-07-20 15:41:16 INFO (MainThread) [homeassistant.setup] Setting up tomorrowio
2022-07-20 15:41:16 INFO (MainThread) [homeassistant.setup] Setup of domain tomorrowio took 0.0 seconds
2022-07-20 15:41:21 DEBUG (MainThread) [homeassistant.components.tomorrowio] Finished fetching Tomorrow.io - Home data in 4.775 seconds (success: False)
2022-07-20 15:41:21 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Tomorrow.io - Home' for tomorrowio integration not ready yet; Retrying in background
2022-07-20 15:42:38 DEBUG (MainThread) [homeassistant.components.tomorrowio] Finished fetching Tomorrow.io - Home data in 16.358 seconds (success: False)
GSzabados commented 2 years ago

Restarted HA again with 0.3.4 already installed and it started to work after 5 minutes. My guess that something has changed again on the API side:


2022-07-20 15:55:30 INFO (MainThread) [homeassistant.setup] Setting up tomorrowio
2022-07-20 15:55:30 INFO (MainThread) [homeassistant.setup] Setup of domain tomorrowio took 0.0 seconds
2022-07-20 15:55:50 DEBUG (MainThread) [homeassistant.components.tomorrowio] Finished fetching Tomorrow.io - Home data in 18.572 seconds (success: False)
2022-07-20 15:55:50 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Tomorrow.io - Home' for tomorrowio integration not ready yet; Retrying in background
2022-07-20 15:57:22 DEBUG (MainThread) [homeassistant.components.tomorrowio] Finished fetching Tomorrow.io - Home data in 4.025 seconds (success: False)
2022-07-20 15:57:42 DEBUG (MainThread) [homeassistant.components.tomorrowio] Finished fetching Tomorrow.io - Home data in 4.420 seconds (success: False)
2022-07-20 15:58:16 DEBUG (MainThread) [homeassistant.components.tomorrowio] Finished fetching Tomorrow.io - Home data in 1.282 seconds (success: False)
2022-07-20 15:58:57 DEBUG (MainThread) [homeassistant.components.tomorrowio] Finished fetching Tomorrow.io - Home data in 0.634 seconds (success: False)
2022-07-20 16:00:18 DEBUG (MainThread) [homeassistant.components.tomorrowio] Finished fetching Tomorrow.io - Home data in 0.702 seconds (success: True)
2022-07-20 16:00:18 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.tomorrowio
2022-07-20 16:00:18 INFO (MainThread) [homeassistant.components.weather] Setting up weather.tomorrowio