question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PRAW raises prawcore.exceptions.BadRequest when attempting to call send_removal_message()

See original GitHub issue

Issue Description

Any time I try to use send_removal_message(), PRAW gives me a 400 error. Looking at the official Reddit API, it appears the endpoints for that function have been removed.

Attempt:

PS C:\Users\Michael\nobackup\Code\Projects\myproject> py
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import praw
>>> reddit = praw.Reddit(user_agent='[my user agent]')
>>> sub = reddit.comment('[a comment I have the ability to moderate]')
>>> sub
Comment(id='[same as before]')
>>> sub.body
'Test comment'
>>> sub.mod
<praw.models.reddit.comment.CommentModeration object at 0x00F20EF0>
>>> sub.mod.send_removal_message
<bound method ThingModerationMixin.send_removal_message of <praw.models.reddit.comment.CommentModeration object at 0x00F20EF0>>
>>> sub.mod.send_removal_message('hi')
{"item_id": ["t1_ew39cg7"], "message": "hi", "title": "ignored", "type": "public"}  # I added this for debugging
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python37-32\lib\site-packages\praw\models\reddit\mixins\__init__.py", line 174, in send_removal_message
    return self.thing._reddit.post(url, data={"json": dumps(data)}) or None
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python37-32\lib\site-packages\praw\reddit.py", line 523, in post
    "POST", path, data=data or {}, files=files, params=params
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python37-32\lib\site-packages\praw\reddit.py", line 577, in request
    method, path, data=data, files=files, params=params
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python37-32\lib\site-packages\prawcore\sessions.py", line 185, in request
    params=params, url=url)
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python37-32\lib\site-packages\prawcore\sessions.py", line 130, in _request_with_retries
    raise self.STATUS_EXCEPTIONS[response.status_code](response)
prawcore.exceptions.BadRequest: received 400 HTTP response
>>>

System Information

  • PRAW Version: 6.3.1
  • Python Version: 3.7.0
  • Operating System: Windows 10 x64

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
bboecommented, Jan 5, 2020

I’m sorry, I totally lost track of this.

It’s not a problem. Life happens 😃.

1reaction
michaelkolbercommented, Aug 9, 2019

Sure, I’d be happy to.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exceptions — PRAW 3.6.2 documentation - Read the Docs
Most of these exceptions occur when you try to do something you don't have authorization to do. For instance trying to remove a...
Read more >
PRAW 4: 400 ERROR when trying to download a users ...
The HTTP 400 Bad Request response status code indicates that the server could not understand the request due to invalid syntax. Now into...
Read more >
PRAW sub.moderator() throwing 400 exception "bad request"
I would try to run this function independently in a separate project to make sure this is praw issue or perhaps an issue...
Read more >
How to use the prawcore.exceptions.Redirect function ... - Snyk
To help you get started, we've selected a few prawcore.exceptions.Redirect examples, based ... InvalidSubreddit without 'len()' around call in the try block ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found