How to use the icloudpd.email_notifications.send_2sa_notification function in icloudpd

To help you get started, we’ve selected a few icloudpd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ndbroadbent / icloud_photos_downloader / icloudpd / base.py View on Github external
or notification_email is not None
        or notification_script is not None
    )
    try:
        icloud = authenticate(
            username,
            password,
            cookie_directory,
            raise_error_on_2sa,
            client_id=os.environ.get("CLIENT_ID"),
        )
    except TwoStepAuthRequiredError:
        if notification_script is not None:
            subprocess.call([notification_script])
        if smtp_username is not None or notification_email is not None:
            send_2sa_notification(
                smtp_username,
                smtp_password,
                smtp_host,
                smtp_port,
                smtp_no_tls,
                notification_email,
            )
        exit(1)

    # Default album is "All Photos", so this is the same as
    # calling `icloud.photos.all`.
    photos = icloud.photos.albums[album]

    if list_albums:
        albums_dict = icloud.photos.albums
        # Python2: itervalues, Python3: values()