From ac0e5791d712eb81ed8922f17c4a21759791d5b8 Mon Sep 17 00:00:00 2001 From: WestXu Date: Sat, 11 Jun 2022 15:19:03 +0800 Subject: [PATCH] Move endpoints of Chinese iCloud account to icloud.com.cn --- pyicloud/base.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyicloud/base.py b/pyicloud/base.py index 6ac8bdbd..fbaf9651 100644 --- a/pyicloud/base.py +++ b/pyicloud/base.py @@ -5,7 +5,7 @@ import logging from requests import Session from tempfile import gettempdir -from os import path, mkdir +from os import environ, path, mkdir from re import match import http.cookiejar as cookielib import getpass @@ -201,8 +201,10 @@ class PyiCloudService: """ AUTH_ENDPOINT = "https://idmsa.apple.com/appleauth/auth" - HOME_ENDPOINT = "https://www.icloud.com" - SETUP_ENDPOINT = "https://setup.icloud.com/setup/ws/1" + + icloud_china = environ.get("icloud_china", "1") == "1" + HOME_ENDPOINT = f"https://www.icloud.com{icloud_china * '.cn'}" + SETUP_ENDPOINT = f"https://setup.icloud.com{icloud_china * '.cn'}/setup/ws/1" def __init__( self,