Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ If you would like to delete a password stored in your system keyring, you can cl

$ icloud [email protected] --delete-from-keyring

Switch to iCloud China mainland domain:

.. code-block:: console

export DOMAIN=cn

**Note**: Authentication will expire after an interval set by Apple, at which point you will have to re-authenticate. This interval is currently two months.

Two-step and two-factor authentication (2SA/2FA)
Expand Down
13 changes: 9 additions & 4 deletions pyicloud/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Library base file."""
import os
from uuid import uuid1
import inspect
import json
Expand Down Expand Up @@ -199,10 +200,14 @@ class PyiCloudService:
pyicloud = PyiCloudService('[email protected]', 'password')
pyicloud.iphone.location()
"""

AUTH_ENDPOINT = "https://idmsa.apple.com/appleauth/auth"
HOME_ENDPOINT = "https://www.icloud.com"
SETUP_ENDPOINT = "https://setup.icloud.com/setup/ws/1"
if os.environ.get("DOMAIN", "") == "cn":
AUTH_ENDPOINT = "https://idmsa.apple.com.cn/appleauth/auth"
HOME_ENDPOINT = "https://www.icloud.com.cn"
SETUP_ENDPOINT = "https://setup.icloud.com.cn/setup/ws/1"
else:
AUTH_ENDPOINT = "https://idmsa.apple.com/appleauth/auth"
HOME_ENDPOINT = "https://www.icloud.com"
SETUP_ENDPOINT = "https://setup.icloud.com/setup/ws/1"

def __init__(
self,
Expand Down