praw-dev / praw

PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.
http://praw.readthedocs.io/
BSD 2-Clause "Simplified" License
3.4k stars 453 forks source link

Reddit API returns HTTP 777 responses during outages 🤪 #1947

Closed snarfed closed 1 year ago

snarfed commented 1 year ago

Describe the Bug

Reddit is recovering from a pretty major outage today: https://www.redditstatus.com/ . During the outage, the API evidently got really wacky and started returning HTTP 777 errors, which praw asserted on while fetching batches of submissions. Code and stack trace below.

I don't know where to even begin with the Reddit API. HTTP 777?!? Not sure if this is worth doing anything on your end, but it's kinda hilarious, so if nothing else, I figured you might get a laugh out of it.

First saw this at 3:42p PT today, still happening.

image

Desired Result

Not sure, but probably not AssertionError.

Code to reproduce the bug

# https://github.com/snarfed/granary/blob/main/granary/reddit.py#L273-L280
# Assertion is on the last line, fetching a batch of submissions.

    self.api = praw.Reddit(
      client_id=reddit.REDDIT_APP_KEY,
      client_secret=reddit.REDDIT_APP_SECRET,
      refresh_token=refresh_token,
      user_agent=util.user_agent,
      # https://praw.readthedocs.io/en/stable/getting_started/configuration/options.html#basic-configuration-options
      check_for_updates=False)
    self.api.read_only = True
    ...
    if activity_id:
      submissions = [self.api.submission(id=activity_id)]
    elif search_query:
      submissions = self.api.subreddit('all').search(search_query, sort='new', limit=count)
    else:
      submissions = self._redditor(user_id).submissions.new(limit=count)

    activities = [self.praw_to_activity(s, 'submission') for s in submissions]

The Reddit() initialization in my code example does not include the following parameters to prevent credential leakage:

client_secret, password, or refresh_token.

Relevant Logs

Traceback (most recent call last):
  ...
  File "/granary/reddit.py", line 280, in <listcomp>
    activities = [self.praw_to_activity(s, 'submission') for s in submissions]
  File ".../praw/models/listing/generator.py", line 63, in __next__
    self._next_batch()
  File ".../praw/models/listing/generator.py", line 89, in _next_batch
    self._listing = self._reddit.get(self.url, params=self.params)
  File ".../praw/util/deprecate_args.py", line 43, in wrapped
    return func(**dict(zip(_old_args, args)), **kwargs)
  File ".../praw/reddit.py", line 712, in get
    return self._objectify_request(method="GET", params=params, path=path)
  File ".../praw/reddit.py", line 517, in _objectify_request
    self.request(
  File ".../praw/util/deprecate_args.py", line 43, in wrapped
    return func(**dict(zip(_old_args, args)), **kwargs)
  File ".../praw/reddit.py", line 941, in request
    return self._core.request(
  File ".../prawcore/sessions.py", line 330, in request
    return self._request_with_retries(
  File ".../prawcore/sessions.py", line 269, in _request_with_retries
    assert (
AssertionError: Unexpected status code: 777

This code has previously worked as intended.

Yes

Operating System/Environment

Ubuntu 18.04

Python Version

3.9

PRAW Version

7.7.0

Prawcore Version

2.3.0

Anything else?

No response

dkgitcode commented 1 year ago

@snarfed Can confirm this is happening to me as well haha. I googled "777 http error code" and found absolutely nothing. I'm assuming that this issue will likely be gone once all reddit services are back up. I believe any request right now throws a 777 response.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

Remove the Stale label or comment or this will be closed in 30 days.

snarfed commented 1 year ago

ah stale bot, never change

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

Remove the Stale label or comment or this will be closed in 30 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stale for 30 days with no activity.