1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-09-11 16:22:24 +02:00

login: print that 2FA is not supported if required

2FA support is requested in issue #200, and also mentioned in #92.
This commit is contained in:
Alexander Graf 2018-12-21 16:54:56 +01:00
parent a735b02bac
commit 4ab0fea82a

View File

@ -195,6 +195,8 @@ class InstaloaderContext:
login = session.post('https://www.instagram.com/accounts/login/ajax/',
data={'password': passwd, 'username': user}, allow_redirects=True)
if login.status_code != 200:
if login.status_code == 400 and login.json().get('two_factor_required', None):
raise ConnectionException("Login error: Two factor authorization not yet supported.")
raise ConnectionException("Login error: {} {}".format(login.status_code, login.reason))
resp_json = login.json()
if resp_json['status'] != 'ok':