-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
401 Error After Running Queries on Loop for >1 hour #22
Comments
Thanks @Pensfan66, I'll see about implementing an automatic refresh. Could you post the full error stacktrace here? |
|
Thanks, I'll take a look! |
Couple comments on the log. Added print commentary for when the thread executes successfully "load successful". Given that its fails on thread 121 i'm almost positive that it has to do with the hourly expiration with my threads updating every 30 seconds. |
Yeah that makes sense... yfpy isn't configured to automatically refresh the token since I've never run it for over the hour token time limit, so seems like a worthwhile addition! |
might have a quick fix at the moment. setting a thread on the init for query.py will refresh it at a given interval. (edit: does not work :) ) |
@Pensfan66 this should be taken care of in v4.1.1 from #23. I didn't do a ton of testing on the automatic refresh since I didn't try out running something past the hour token expiration period, but I think this should re-authenticate the query object if you get that 401 unauthenticated error. If for some reason it doesn't, just reopen this issue and we'll get it sorted. |
Kind of a similar issue, however I believe mine is an expired token issue.
What I'm trying to do is run the test_get_league_scoreboard_by_week() function on a thread in order to push live updates (every 30 sec) to a led matrix. So far it works flawlessly for about an hour and then 401 errors repeating. I restart the code and everything runs as it should for another hour until I hit 401's again. Looked into this in YF api documentation and it checks out that the token expires every hour.
Any thoughts on how I could code a refresh into the 401 error try/except portion? Or any thoughts in general on getting around this?
Originally posted by @Pensfan66 in #21 (comment)
The text was updated successfully, but these errors were encountered: