【问题标题】:2FA failing in Instaloader2FA 在 Instaloader 中失败
【发布时间】:2021-07-14 19:19:19
【问题描述】:

尝试使用 Instaloader 登录 Instagram,

L = ig.Instaloader()
L.login(user, password)
L.two_factor_login(11111)

引发以下错误

raise TwoFactorAuthRequiredException("Login error: two-factor authentication required.")
instaloader.exceptions.TwoFactorAuthRequiredException: Login error: two-factor authentication required.

【问题讨论】:

    标签: python instaloader


    【解决方案1】:

    documentation 提到如果 2FA 登录的第一步完成,则会引发 TwoFactorAuthRequiredException,并且您应该调用 Instaloader.two_factor_login() - 但由于在您的代码中引发了异常,因此永远不会到达该调用。

    尝试类似:

    from instaloader.exceptions import TwoFactorAuthRequiredException
    
    L = ig.Instaloader()
    
    try:
        L.login(user, password)
    except TwoFactorAuthRequiredException:
        L.two_factor_login(11111)
    

    【讨论】:

    • 工作!使用 python 一年多了,但仍然无法从文档中弄清楚这一点。
    猜你喜欢
    • 2022-07-12
    • 2014-10-22
    • 1970-01-01
    • 1970-01-01
    • 2021-07-06
    • 2017-01-01
    • 1970-01-01
    • 2022-09-24
    • 1970-01-01
    相关资源
    最近更新 更多