icloud-photos-downloader / icloud_photos_downloader

A command-line tool to download photos from iCloud
MIT License
6.85k stars 554 forks source link

crashed during 2fa (Failed to execute script 'icloudpd_ex' due to unhandled exception!) #782

Closed skywinder closed 9 months ago

skywinder commented 9 months ago

Overview

Steps to Reproduce

  1. run the script docker run -it --rm --name icloudpd -v $(pwd)/Photos:/data -e TZ=Asia/Ho_Chi_Minh icloudpd/icloudpd:latest icloudpd --directory /data --username myemail --watch-with-interval 3600
  2. enter pasword
  3. allow aces via opened window for 2fa

Expected Behavior

want to put 6 digits 2fa

Actual Behavior

got error log:

2024-02-01 01:42:47 DEBUG    Authenticating...
iCloud Password:
Traceback (most recent call last):
  File "urllib3/connectionpool.py", line 714, in urlopen
  File "urllib3/connectionpool.py", line 466, in _make_request
  File "<string>", line 3, in raise_from
  File "urllib3/connectionpool.py", line 461, in _make_request
  File "http/client.py", line 1419, in getresponse
  File "http/client.py", line 331, in begin
  File "http/client.py", line 300, in _read_status
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "requests/adapters.py", line 486, in send
  File "urllib3/connectionpool.py", line 798, in urlopen
  File "urllib3/util/retry.py", line 550, in increment
  File "urllib3/packages/six.py", line 769, in reraise
  File "urllib3/connectionpool.py", line 714, in urlopen
  File "urllib3/connectionpool.py", line 466, in _make_request
  File "<string>", line 3, in raise_from
  File "urllib3/connectionpool.py", line 461, in _make_request
  File "http/client.py", line 1419, in getresponse
  File "http/client.py", line 331, in begin
  File "http/client.py", line 300, in _read_status
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "starters/icloudpd_ex.py", line 110, in <module>
  File "starters/icloudpd_ex.py", line 106, in main
  File "click/core.py", line 1157, in __call__
  File "click/core.py", line 1078, in main
  File "click/core.py", line 1688, in invoke
  File "click/core.py", line 1434, in invoke
  File "click/core.py", line 783, in invoke
  File "icloudpd/base.py", line 328, in main
  File "icloudpd/base.py", line 760, in core
  File "icloudpd/authentication.py", line 31, in authenticate_
  File "pyicloud_ipd/base.py", line 305, in __init__
  File "pyicloud_ipd/base.py", line 367, in authenticate
  File "pyicloud_ipd/base.py", line 387, in _authenticate_with_token
  File "requests/sessions.py", line 637, in post
  File "pyicloud_ipd/base.py", line 77, in request
  File "requests/sessions.py", line 589, in request
  File "requests/sessions.py", line 703, in send
  File "requests/adapters.py", line 501, in send
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
[8] Failed to execute script 'icloudpd_ex' due to unhandled exception!

Context

just run via docker on mac

AndreyNikiforov commented 9 months ago

@skywinder are you running from mainland China by any chance? If yes, then it is a known issue and needs a resident to debug/troubleshoot (I was not able to get VPN to get into China).

skywinder commented 9 months ago

no, it's from Vietnam. But have error Max retries exceeded with url: /appleauth/auth/signin?isRememberMeEnabled=true

which is someting new.

2024-02-01 11:11:43 DEBUG    Authenticating...
iCloud Password:
Traceback (most recent call last):
  File "urllib3/connection.py", line 174, in _new_conn
  File "urllib3/util/connection.py", line 72, in create_connection
  File "socket.py", line 963, in getaddrinfo
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "urllib3/connectionpool.py", line 714, in urlopen
  File "urllib3/connectionpool.py", line 403, in _make_request
  File "urllib3/connectionpool.py", line 1053, in _validate_conn
  File "urllib3/connection.py", line 363, in connect
  File "urllib3/connection.py", line 186, in _new_conn
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0xffff9abe9fa0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "requests/adapters.py", line 486, in send
  File "urllib3/connectionpool.py", line 798, in urlopen
  File "urllib3/util/retry.py", line 592, in increment
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='idmsa.apple.com', port=443): Max retries exceeded with url: /appleauth/auth/signin?isRememberMeEnabled=true (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff9abe9fa0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "starters/icloudpd_ex.py", line 110, in <module>
  File "starters/icloudpd_ex.py", line 106, in main
  File "click/core.py", line 1157, in __call__
  File "click/core.py", line 1078, in main
  File "click/core.py", line 1688, in invoke
  File "click/core.py", line 1434, in invoke
  File "click/core.py", line 783, in invoke
  File "icloudpd/base.py", line 328, in main
  File "icloudpd/base.py", line 760, in core
  File "icloudpd/authentication.py", line 31, in authenticate_
  File "pyicloud_ipd/base.py", line 305, in __init__
  File "pyicloud_ipd/base.py", line 357, in authenticate
  File "requests/sessions.py", line 637, in post
  File "pyicloud_ipd/base.py", line 77, in request
  File "requests/sessions.py", line 589, in request
  File "requests/sessions.py", line 703, in send
  File "requests/adapters.py", line 519, in send
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='idmsa.apple.com', port=443): Max retries exceeded with url: /appleauth/auth/signin?isRememberMeEnabled=true (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff9abe9fa0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
[8] Failed to execute script 'icloudpd_ex' due to unhandled exception!
AndreyNikiforov commented 9 months ago

see #643 for Max retries error

skywinder commented 9 months ago

Yay! It was a problem with Vietnam, I believe, similar to China. I tried to log in via VPN, and now it's working. Thank you for your support! (I will support your project back with a donation - btw - where to donate?)

P.S. I got 2024-02-02 12:36:45 WARNING Failed to parse response with JSON mimetype - is this something normal?

(I see it appears in other issues as well: https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues?q=Failed+to+parse+response+with+JSON+mimetype)

AndreyNikiforov commented 9 months ago

P.S. I got 2024-02-02 12:36:45 WARNING Failed to parse response with JSON mimetype - is this something normal?

(I see it appears in other issues as well: https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues?q=Failed+to+parse+response+with+JSON+mimetype)

Yeah, it started appearing after our latest refactoring of the auth code to address sudden API changes on Apple side. These warning seems to not affect functionality in any known way.