En Reddit, un redditor es el término dado a un usuario. Aquí veremos cómo verificar si un redditor es un empleado de Reddit o no. Usaremos el is_employee
atributo de la Redditor
clase para verificar si un redditor es un empleado de Reddit o no.
Ejemplo 1: Considere el siguiente redditor:
El nombre de usuario del redditor es: spez, spez es el fundador de reddit, por lo que es un empleado de Reddit.
# importing the module import praw # initialize with appropriate values client_id = "" client_secret = "" username = "" password = "" user_agent = "" # creating an authorized reddit instance reddit = praw.Reddit(client_id = client_id, client_secret = client_secret, username = username, password = password, user_agent = user_agent) # the name of the redditor redditor_name = "spez" # instantiating the Redditor class redditor = reddit.redditor(redditor_name) print("Is " + redditor_name + " an employee of Reddit? : " + str(redditor.is_employee))
Producción :
Is spez an employee of Reddit? : True
Ejemplo 2: Considere el siguiente redditor:
El nombre de usuario del redditor es: AutoModerador
# importing the module import praw # initialize with appropriate values client_id = "" client_secret = "" username = "" password = "" user_agent = "" # creating an authorized reddit instance reddit = praw.Reddit(client_id = client_id, client_secret = client_secret, username = username, password = password, user_agent = user_agent) # the name of the redditor redditor_name = "AutoModerator" # instantiating the Redditor class redditor = reddit.redditor(redditor_name) print("Is " + redditor_name + " an employee of Reddit? : " + str(redditor.is_employee))
Producción :
Is AutoModerator an employee of Reddit? : False