setup_bot.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:AFSCbot 作者: HadManySons 项目源码 文件源码
def login():

    # Try to login or sleep/wait until logged in, or exit if user/pass wrong
    NotLoggedIn = True
    while NotLoggedIn:
        try:
            reddit = praw.Reddit(
                user_agent=credsUserAgent,
                client_id=credsClientID,
                client_secret=credsClientSecret,
                username=credsUserName,
                password=credsPassword)
            print_and_log("Logged in")
            NotLoggedIn = False
        except praw.errors.InvalidUserPass:
            print_and_log("Wrong username or password", error=True)
            exit(1)
        except Exception as err:
            print_and_log(str(err), error=True)
            time.sleep(5)
    return reddit
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号