I'm using PRAW to view a large number of Reddit search results (both submissions and comments), and the method I'm using to collect the data is frequently generating a 503 error:
prawcore.exceptions.ServerError: received 503 HTTP response
As I understand it, if it were a rate limit issue, PRAW would throw a praw.errors.RateLimitExceeded
error.
The function in which the error is produced, is the following:
def search_subreddit(subreddit_name, last_post=None):
params = {'sort': 'new', 'time_filter': 'year',
'limit': 100, 'syntax':'cloudsearch'}
if last_post:
start_time = 0
end_time = int(last_post.created) + 1
query = 'timestamp:%s..%s' % (start_time, end_time)
else:
query = ''
return reddit.subreddit(subreddit_name).search(query, **params)
That's being called within a loop. Any idea as to why the 503 error is being generated, and how to prevent it from happening?