Skip to content
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

Exceptions from Praw comments stream crashes bot #9

Open
AlexBurkey opened this issue May 26, 2020 · 0 comments
Open

Exceptions from Praw comments stream crashes bot #9

AlexBurkey opened this issue May 26, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@AlexBurkey
Copy link
Owner

Describe the bug
Currently using Praw's reddit comments stream to monitor comments in the subreddit. When there is an issue with the stream or reddit like a 503 error the program just raises the exception and drops out

To Reproduce
Take reddit down I guess? I'm not interested in mocking a reddit client.

Expected behavior
The bot should be able to deal with reddit being down just like it deals with issues with making requests to Imgur.

Additional context
nohup.out log:

Setting up DB...
Done!
Looking for comments...
Traceback (most recent call last):
  File "bot.py", line 250, in <module>
    for comment in r.subreddit(SUBREDDIT_NAME).stream.comments():
  File "/home/pi/.local/lib/python3.7/site-packages/praw/models/util.py", line 186, in stream_generator
    for item in reversed(list(function(limit=limit, **function_kwargs))):
  File "/home/pi/.local/lib/python3.7/site-packages/praw/models/listing/generator.py", line 61, in __next__
    self._next_batch()
  File "/home/pi/.local/lib/python3.7/site-packages/praw/models/listing/generator.py", line 71, in _next_batch
    self._listing = self._reddit.get(self.url, params=self.params)
  File "/home/pi/.local/lib/python3.7/site-packages/praw/reddit.py", line 490, in get
    return self._objectify_request(method="GET", params=params, path=path)
  File "/home/pi/.local/lib/python3.7/site-packages/praw/reddit.py", line 574, in _objectify_request
    data=data, files=files, method=method, params=params, path=path
  File "/home/pi/.local/lib/python3.7/site-packages/praw/reddit.py", line 732, in request
    timeout=self.config.timeout,
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 336, in request
    url=url,
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 235, in _request_with_retries
    url,
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 195, in _make_request
    timeout=timeout,
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/rate_limit.py", line 35, in call
    kwargs["headers"] = set_header_callback()
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 282, in _set_header_callback
    self._authorizer.refresh()
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/auth.py", line 352, in refresh
    password=self._password,
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/auth.py", line 149, in _request_token
    response = self._authenticator._post(url, **data)
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/auth.py", line 32, in _post
    raise ResponseException(response)
prawcore.exceptions.ResponseException: received 503 HTTP response
[Sun 24 May 14:47:38 BST 2020] bot exited with code 1. restarting ...
@AlexBurkey AlexBurkey self-assigned this May 27, 2020
@AlexBurkey AlexBurkey added the bug Something isn't working label May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant