diff --git a/README.rst b/README.rst index 3608b4b..9b2c777 100644 --- a/README.rst +++ b/README.rst @@ -64,11 +64,28 @@ If you would like to delete a password stored in your system keyring, you can cl Two-step and two-factor authentication (2SA/2FA) ************************************************ -If you have enabled `two-step authentication (2SA) `_ for the account you will have to do some extra work: +If you have enabled two-factor authentications (2FA) or `two-step authentication (2SA) `_ for the account you will have to do some extra work: .. code-block:: python - if api.requires_2sa: + if api.requires_2fa: + print "Two-factor authentication required." + code = input("Enter the code you received of one of your approved devices: ") + result = api.validate_2fa_code(code) + print("Code validation result: %s" % result) + + if not result: + print("Failed to verify security code") + sys.exit(1) + + if not api.is_trusted_session: + print("Session is not trusted. Requesting trust...") + result = api.trust_session() + print("Session trust result %s" % result) + + if not result: + print("Failed to request trust. You will likely be prompted for the code again in the coming weeks") + elif api.requires_2sa: import click print "Two-step authentication required. Your trusted devices are:" @@ -88,7 +105,6 @@ If you have enabled `two-step authentication (2SA) `_, but the authentication will time out after a few hours. Full support for two-factor authentication (2FA) is not implemented in PyiCloud yet. See issue `#102 `_. Devices diff --git a/setup.py b/setup.py index de7c062..e3c5dc4 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages from codecs import open REPO_URL = "https://github.com/picklepete/pyicloud" -VERSION = "0.9.7" +VERSION = "0.10.2" with open("requirements.txt") as f: required = f.read().splitlines()