-
Notifications
You must be signed in to change notification settings - Fork 255
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
ValueError: invalid literal for int() with base 16: b'' #505
Comments
Sounds like there's a fix coming https://twittercommunity.com/t/filtered-stream-request-breaks-in-5-min-intervals/153926/19?u=igorbrigadir 🙏 |
On the one hand it's good there's a fix coming. On the other I'm disappointed I haven't had time to work on a fix in twarc that should be able to catch this and reconnect. |
Yes, on the bright side, #477 should help address future disconnects |
I think the twarc.decorators2.catch_requests_exceptions isn't working with twarc.Twarc2.stream because even though the call to Twarc2.stream() is getting wrapped, it returns a response which is then streamed from with |
This commit reuses twarc.decorators2.catch_request_exceptions in the context of streaming responses with iter_lines. Hopefully this will address #505 but it will require testing by people who continue seeing the error in the wild.
This commit adds an internal method Twarc2._stream which is used by both the Twarc2.stream and Twarc2.sample methods to connect to the Twitter API and stream results. It is wrapped with the catch_request_exceptions decorator, which ought to catch an request errors, log them and retry, and hopefully this will finally address #505. 🤞
The catch_request_exceptions decorator wasn't working well with streaming responses which return an object successfully, but later throw an exception when iter_lines() is called and iterated over. Now there is a somewhat duplicative bit of logic in Twarc2._stream for catching request exceptions, trying again with an exponential backoff. Refs #505
I think this is fixed now - https://twittercommunity.com/t/filtered-stream-request-breaks-in-5-min-intervals/153926/20?u=igorbrigadir on twitter's end. Unfortunately if there's still doubt about our own error handling, it may not be possible to reproduce, unless we mock a connection and manually insert some bogus |
I'm seeing this again while running
twarc stream
and am confused why twarc isn't catching/restarting:The text was updated successfully, but these errors were encountered: