iprak / yahoofinance

Home Assistant component which allows you to get stock updates from Yahoo finance.
MIT License
81 stars 11 forks source link

Timed out getting crumb. #125

Open Johnyboy1984 opened 8 months ago

Johnyboy1984 commented 8 months ago

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.yahoofinance.coordinator Quelle: custom_components/yahoofinance/coordinator.py:105 Integration: Yahoo Finance (Dokumentation, Probleme) Erstmals aufgetreten: 22:00:59 (1 Vorkommnisse) Zuletzt protokolliert: 22:00:59

Timed out getting crumb.

iprak commented 8 months ago

Do you see any delay in accessing the Yahoo finance the very time from your location?

Johnyboy1984 commented 8 months ago

What do you mean by "Are you noticing a delay at your location?" ?

I notice that the sensors provide values, but the error is still in the log.

iprak commented 8 months ago

The integration retries getting cookie info and that is why sensors have value. This should coincide with the behavior when accessing Yahoo Finance website the very first time. If sensors report value then you will have to just ignore the error. This could be related to your location where GPR authorization has been enforced.

Johnyboy1984 commented 8 months ago

If I understand you correctly then the error is triggered by my location and if I still get values then I can just ignore this error. Correct?

iprak commented 7 months ago

The crumb cookie is needed for extracting data. "Timed out getting crumb" is the exception thrown if the request to obtain the cookie did not complete in 15 seconds. Whenever symbol data is refreshed, if the cookie is missing, then an attempt will be made to get it first.

If the error is not logged continuously, then the cookie request eventually succeeded, meaning we recovered and the error can be ignored. The initial failure will still get logged as an error.

For more investigation, you would have to use Networking monitoring tools like in Chrome Dev Tools and see what does the traffic for the very initial request look like.

wburgers commented 6 months ago

I'm experiencing this issue.

My sensors do not provide values. It keeps failing to get the crumb. Many 1000s of times.

I don't know exactly when it started. If it was yahoofinance 1.2.9 or HA 2024.5.4 that causes issues. The last value for some sensors is the 17th of May, so that would indicate HA 2024.5.4.

I have set my home assistant logging config like:

logger:
  default: warn
  logs:
    custom_components.yahoofinance: debug

But that does not provide any additional logs.

I'll test if HA 2024.5.3 is better.

EDIT: Nope going back to 2024.5.3 does not fix it. Also going back to 1.2.8 of yahoofinance does not fix it either.

wburgers commented 6 months ago

And now it magically works again.

After a few days of not working and a few HA restarts.

Let's hope it keeps working 🤞

iprak commented 6 months ago

There has been no change in the integration regarding this. The request waits for 15 seconds before throwing that exception and then retries later.

ctaggmk commented 1 month ago

Here's the error I get on startup

This error originated from a custom integration.

Logger: homeassistant.setup Source: custom_components/yahoofinance/coordinator.py:85 Integration: yahoofinance (documentation, issues) First occurred: 22:21:09 (1 occurrences) Last logged: 22:21:09

Error during setup of component yahoofinance Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 256, in _async_setup_component result = await task File "/config/custom_components/yahoofinance/init.py", line 290, in async_setup await _setup_coordinator() File "/config/custom_components/yahoofinance/init.py", line 238, in _setup_coordinator crumb = await crumb_coordinator.try_get_crumb_cookies() # Get crumb first File "/config/custom_components/yahoofinance/coordinator.py", line 85, in try_get_crumb_cookies async with asyncio.timeout(WEBSESSION_TIMEOUT): AttributeError: module 'asyncio' has no attribute 'timeout'

There are no sensor.yahoofinance entities listed

Looking back at the comments, are we suggesting an HA upgrade will help? I am running "Home Assistant 2023.4.6 Frontend 20230411.1 - latest" so am a little bit behind!

iprak commented 1 month ago

Yes the Core is quite old, that is from April 2023. It seems async.timeout is present in Python 3.11 which was adopted in 2023.6. I think updating core would be necessary.

ctaggmk commented 1 month ago

I've updated and still have this error from UI This error originated from a custom integration.

Logger: custom_components.yahoofinance Source: custom_components/yahoofinance/init.py:241 integration: Yahoo Finance (documentation, issues) First occurred: 19:28:06 (1 occurrences) Last logged: 19:28:06

Unable to get crumb, re-trying in 15 seconds

and if I look in the logs I see these lines (non-Yahoo lines removed) 2024-10-13 19:27:55.714 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration yahoofinance which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2024-10-13 19:28:06.234 WARNING (MainThread) [custom_components.yahoofinance] Unable to get crumb, re-trying in 15 seconds 2024-10-13 19:28:21.604 WARNING (MainThread) [custom_components.yahoofinance.coordinator] No data received for ['EXPN', 'GB00B02LCD75']

iprak commented 1 month ago

Was the data successfully obtained in subsequent fetch?

ctaggmk commented 1 month ago

ah yes, it's better today. It's pulled BP and FTSE but not Experian. Let me check the ticker symbol for Experian as that looks more like my error