praw: Attempting to respond to Reddit administrator messages throws 403

Issue Description

Certain Reddit messages cannot be responded to, and are often sent in bulk without regard for who the recipient is. A bot I am working on got sent one of these messages, and attempted to respond to it. However, a 403 error was received, terminating the process. On the website, there is not a Reply button to these messages. Is there any meaningful way of distinguishing these messages from other messages so that I don’t have to hardcode all the administrators and prevent my bot from replying to them?

The specific message is an invitation for /r/community_chat. That message has no reply button on it, but it originates from a Reddit admin.

screen shot 2018-05-15 at 4 20 48 pm
  File "/usr/local/lib/python3.5/dist-packages/prawcore/sessions.py", line 182, in request
    params=params, url=url)
  File "/usr/local/lib/python3.5/dist-packages/prawcore/sessions.py", line 127, in _request_with_retries
    raise self.STATUS_EXCEPTIONS[response.status_code](response)
prawcore.exceptions.Forbidden: received 403 HTTP response

System Information

  • PRAW Version: 5.4.0
  • Python Version: 3.5.2
  • Operating System: Ubuntu 16.04.4 LTS

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (14 by maintainers)

Most upvoted comments

PRAW should not let any actions silently fail because then its users will think that the requested action went through when it in fact didn’t.

Throwing exceptions or not shouldn’t be an option that’s up to the caller. If the caller wishes to ignore a particular exception, they should use a try-except block to catch and ignore it.

in addition, that just isn’t expected behavior. there are non-distinguished non-admin messages that are unreplyable too and it’s just something that can’t be determined as stated by others in the thread.

@SheaBelsky see the second part of @kwwxis’s reply:

There does appear to be a message.distinguished which is equal to “admin”. But that alone doesn’t mean the message can’t be replied to since there are reply-able admin messages: