Twitter-API-v2-sample-code icon indicating copy to clipboard operation
Twitter-API-v2-sample-code copied to clipboard

Handled ChunkedEncodingError in filtered_stream.py

Open pranftw opened this issue 4 years ago • 5 comments

ChunkedEncodingError was raised every 5 mins due to some issue with the servers that the requests module couldn't handle. The request to get the stream was wrapped in a try-except block and the entire code in get_stream is made to run forever using while(True):. Whenever a KeyboardInterrupt is raised using ctrl + C, the program and the stream gets suspended. When a ChunkedEncodingError is caught, the program execution continues with continue, thus causing the new request to the stream to be made automatically whenever ChunkedEncodingError is raised and caught. Finally any other Exceptions will be raised.

TO THE MAINTAINERS This is my first pull request on GitHub on any repo. So please excuse me if I did not follow the proper format for this pull request. I've tested the code, in case you had any doubts regarding that. Thanks!

twitterAPI

pranftw avatar Jun 05 '21 05:06 pranftw

CLA Assistant Lite bot All Contributors have signed the CLA. If the commit check is not passing, a maintainer must go the Checks tab of this PR and rerun the GitHub Action.

github-actions[bot] avatar Jun 05 '21 05:06 github-actions[bot]

I have read the CLA Document and I hereby sign the CLA

pranftw avatar Jun 05 '21 05:06 pranftw

recheck

pranftw avatar Jun 05 '21 05:06 pranftw

recheck

pranftw avatar Jun 05 '21 05:06 pranftw

I have read the CLA Document and I hereby sign the CLA

pranftw avatar Jun 05 '21 05:06 pranftw