Created
May 28, 2020 00:03
-
-
Save jarhill0/384458102d89993b41e62804d445c5ff to your computer and use it in GitHub Desktop.
Test Reddit ratelimit usage rate — runs for 60 seconds without output and then exits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import monotonic | |
import praw | |
reddit = praw.Reddit(...) # authenticate | |
print(f'Authenticated as {reddit.user.me()}') | |
start_time = monotonic() | |
used_at_start = reddit._core._rate_limiter.used | |
for submission in reddit.subreddit("all").stream.submissions(): | |
if monotonic() - start_time > 60: | |
break | |
used_at_end = reddit._core._rate_limiter.used | |
print(f"{used_at_end - used_at_start} requests made in 60 seconds") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment