orakaro / rainbowstream

A smart and nice Twitter client on terminal written in Python.
https://github.com/orakaro/rainbowstream
MIT License
3.54k stars 260 forks source link

503 being received causing an exception to occur, leading to a secondary exception with auth details displayed on terminal. #336

Open zenonymus opened 1 year ago

zenonymus commented 1 year ago

These exceptions outputs seem to occur frequently. It does not seem to affect the underlying function of the application as it does not break, however, it does disrupt the display of the output. Is there a 'best' command line parameter to resolve this or does this need addressed in the code itself? I've remove the parameters in the below exception output for authenticating for obvious reasons. It seems to me that it would be best that the application not display that particular info as part of the exception. But i'm not a programmer. I'm an end user that would not want authentication details dumped in clear text on the terminal through a repeatable dysfunction caused by 503 errors on the other end which is instantiated by default settings or otherwise.

Exception in thread Thread-1 (stream):
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/twitter/api.py", line 386, in _handle_response
    handle = urllib_request.urlopen(req, **kwargs)
  File "/usr/lib/python3.10/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.10/urllib/request.py", line 525, in open
    response = meth(req, response)
  File "/usr/lib/python3.10/urllib/request.py", line 634, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.10/urllib/request.py", line 563, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 503: Service Unavailable
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/malphas/.local/lib/python3.10/site-packages/rainbowstream/rainbow.py", line 2217, in stream
    poll()
  File "/home/malphas/.local/lib/python3.10/site-packages/rainbowstream/rainbow.py", line 343, in poll
    result = t.statuses.home_timeline(**kwargs)
  File "/usr/local/lib/python3.10/dist-packages/twitter/api.py", line 371, in __call__
    return self._handle_response(req, uri, arg_data, _timeout)
  File "/usr/local/lib/python3.10/dist-packages/twitter/api.py", line 417, in _handle_response
    raise TwitterHTTPError(e, uri, self.format, arg_data)
twitter.api.TwitterHTTPError: Twitter sent status 503 for URL: 1.1/statuses/home_timeline.json using parameters: (***OAUTH ETC REMOVED FOR OBVIOUS REASONS***)
details: {'errors': [{'message': 'Over capacity', 'code': 130}]}

Thanks.