📌  相关文章
📜  Python PRAW – 检查 redditor 是否验证了他们的电子邮件

📅  最后修改于: 2022-05-13 01:54:44.475000             🧑  作者: Mango

Python PRAW – 检查 redditor 是否验证了他们的电子邮件

在 Reddit 中,redditor 是给予用户的术语。 Reddit 要求每个用户在注册帐户后验证他们的帐户。在这里,我们将看到如何检查 redditor 是否验证了他们的电子邮件。我们将使用Redditor类的has_verified_email属性来检查 redditor 是否验证了他们的电子邮件。

示例 1:考虑以下 redditor:

redditor 的用户名是: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("Has " + redditor_name + " verified their email? : " +
      str(redditor.has_verified_email))

输出 :

Has prez verified their email? : True

示例 2:考虑以下 redditor:

redditor 的用户名是:AutoModerator

# 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("Has " + redditor_name + " verified their email? : " +
      str(redditor.has_verified_email))

输出 :

Has AutoModerator verified their email? : True