CLI.py 文件源码

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

项目:competitive-cli 作者: GDGVIT 项目源码 文件源码
def login(website=None):
    global websiteObject
    global acc_manager

    if website is None and acc_manager.account is not None:
        website, username, password = acc_manager.get_account(acc_manager.account)
        websiteObject = websiteObject.factoryMethod(website)
    else:
        username = input("Enter your username: ")
        try:
            password = getpass.getpass("Enter your password: ")
        except getpass.GetPassWarning:
            print("Your system is not allowing us to disable echo. We cannot read your password")
            return

    if website is None and websiteObject is None:
        website = input("Enter website: ")
        websiteObject = SessionAPI.SessionAPI().factoryMethod(website)
    elif websiteObject is None:
        websiteObject = SessionAPI.SessionAPI().factoryMethod(website)

    websiteObject.login(username, password)

    acc_manager.insert(website, username, password)

    if websiteObject.logged_in:
        print("Successful Login")
    else:
        print("Login Failed")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号