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.

Get AssertionError when submitting url post to selftext only subreddit while ratelimited

See original GitHub issue

Describe the bug

If I am ratelimted on Reddit, such as for posting to /r/tifu, and I post a URL post, which is banned, instead of getting either error, I get an AssertionError

To Reproduce Steps to reproduce the behavior: Submit to a selftext-only subreddit while post-ratelimited.

Expected behavior

Raise one or both errors

Code/Logs

Code:

reddit.subreddit("tifu").submit("Test", url="https://www.google.com", validate_on_submit=True)

Error:

  File "<ipython-input-8-2dd185cc0bda>", line 1, in <module>
    reddit.subreddit("tifu").submit("Test", url="https://www.google.com", validate_on_submit=True)
  File "~/PycharmProjects/praw/praw/models/reddit/subreddit.py", line 835, in submit
    return self._reddit.post(API_PATH["submit"], data=data)
  File "~/PycharmProjects/praw/praw/reddit.py", line 560, in post
    return self._objector.objectify(data)
  File "~/PycharmProjects/praw/praw/objector.py", line 172, in objectify
    errors,
AssertionError: ('Errors did not get raised as an APIException', [['NO_LINKS', 'that subreddit only allows text posts', 'sr'], ['RATELIMIT', 'you are doing that too much. try again in 13 minutes.', 'ratelimit']])

System Info

  • OS: MacOS 10.14
  • Python: 3.7
  • PRAW Version: 7.0.0dev0

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jarhill0commented, Feb 11, 2020

@pythoncoderas what happens if you don’t pass that parameter?

0reactions
Pyprohlycommented, Feb 13, 2020

I once had plans to make APIException iterable and then take these assertions out but never got around to it. Regardless of whether @PythonCoderAS’ story is true or not, multiple API errors is definitely a possibly and these assertions need to be dealt with.

A reliable way to reproduce multiple errors for the purposes of testing:

reddit.post('/api/submit', data={'api_type': 'json', 'sr': 'private', 'kind': 'asdf'})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Change Log — PRAW 7.3.0 documentation - Read the Docs
Ability to pass a gallery url to Reddit.submission() . ... Add method invited() to get invited moderators of a subreddit. Ability to submit...
Read more >
Python Reddit API Wrapper Documentation - Read the Docs
So we test if any of the strings are within the selftext, and if they are the bot sends me a message. But...
Read more >
Retrieving only entries with selftext reddit praw - Stack Overflow
I got 'selftext': '[removed]' in self text while fetching data by users. Any Idea? – parlad. May 29 at 6:37. Add a ...
Read more >
How does Rate Limiting work? · Issue #15 · krisives/cronnit.com
It's only when I use Cronnit that I'm hit with the rate limit error. Error message is simply 'This post has been rate...
Read more >
what does ratelimit error mean? : r/redditdev
I'm currently only posting on testing subreddits. I even got an error while trying to submit this post. "you are doing that too...
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