Is it possible to check if a specified user exists using PRAW, and if so what is the proper way to do so? I couldn't find any builtin functions that do this, so your help would be appreciated.
Arnav's answer only works in old versions of PRAW (prior to 2016). If you're starting a new project, you should use the newest version of PRAW. In that version, here's the code that works:
import praw
from prawcore.exceptions import NotFound
reddit = praw.Reddit( # authentication goes here
)
def user_exists(name):
try:
reddit.redditor(name).id
except NotFound:
return False
return True