En Reddit, un redditor es el término dado a un usuario. Reddit permite a los redditores aprovechar el acceso premium mediante el pago de una tarifa. Aquí veremos cómo verificar si un redditor tiene acceso premium o no. Usaremos el is_gold
atributo de la Redditor
clase para verificar si un redditor tiene acceso premium o no.
Ejemplo 1: Considere el siguiente redditor:
El nombre de usuario del redditor es: spez.
# 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("Does " + redditor_name + " has an active Reddit Premium status? : " + str(redditor.is_gold))
Producción :
Does spez has an active Reddit Premium status? : 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("Does " + redditor_name + " has an active Reddit Premium status? : " + str(redditor.is_gold))
Producción :
Does AutoModerator has an active Reddit Premium status? : True