Choose to fetch family devices (#235)
This commit is contained in:
parent
ef4eba7cdd
commit
ffadb4cf3a
2 changed files with 14 additions and 11 deletions
|
@ -145,13 +145,14 @@ class PyiCloudService(object):
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, apple_id, password=None, cookie_directory=None, verify=True,
|
self, apple_id, password=None, cookie_directory=None, verify=True,
|
||||||
client_id=None
|
client_id=None, with_family=True
|
||||||
):
|
):
|
||||||
if password is None:
|
if password is None:
|
||||||
password = get_password_from_keyring(apple_id)
|
password = get_password_from_keyring(apple_id)
|
||||||
|
|
||||||
self.data = {}
|
self.data = {}
|
||||||
self.client_id = client_id or str(uuid.uuid1()).upper()
|
self.client_id = client_id or str(uuid.uuid1()).upper()
|
||||||
|
self.with_family = with_family
|
||||||
self.user = {'apple_id': apple_id, 'password': password}
|
self.user = {'apple_id': apple_id, 'password': password}
|
||||||
|
|
||||||
self._password_filter = PyiCloudPasswordFilter(password)
|
self._password_filter = PyiCloudPasswordFilter(password)
|
||||||
|
@ -314,7 +315,8 @@ class PyiCloudService(object):
|
||||||
return FindMyiPhoneServiceManager(
|
return FindMyiPhoneServiceManager(
|
||||||
service_root,
|
service_root,
|
||||||
self.session,
|
self.session,
|
||||||
self.params
|
self.params,
|
||||||
|
self.with_family
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -14,15 +14,16 @@ class FindMyiPhoneServiceManager(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, service_root, session, params):
|
def __init__(self, service_root, session, params, with_family=False):
|
||||||
self.session = session
|
self.session = session
|
||||||
self.params = params
|
self.params = params
|
||||||
self._service_root = service_root
|
self.with_family = with_family
|
||||||
self._fmip_endpoint = '%s/fmipservice/client/web' % self._service_root
|
|
||||||
self._fmip_refresh_url = '%s/refreshClient' % self._fmip_endpoint
|
fmip_endpoint = '%s/fmipservice/client/web' % service_root
|
||||||
self._fmip_sound_url = '%s/playSound' % self._fmip_endpoint
|
self._fmip_refresh_url = '%s/refreshClient' % fmip_endpoint
|
||||||
self._fmip_message_url = '%s/sendMessage' % self._fmip_endpoint
|
self._fmip_sound_url = '%s/playSound' % fmip_endpoint
|
||||||
self._fmip_lost_url = '%s/lostDevice' % self._fmip_endpoint
|
self._fmip_message_url = '%s/sendMessage' % fmip_endpoint
|
||||||
|
self._fmip_lost_url = '%s/lostDevice' % fmip_endpoint
|
||||||
|
|
||||||
self._devices = {}
|
self._devices = {}
|
||||||
self.refresh_client()
|
self.refresh_client()
|
||||||
|
@ -39,7 +40,7 @@ class FindMyiPhoneServiceManager(object):
|
||||||
data=json.dumps(
|
data=json.dumps(
|
||||||
{
|
{
|
||||||
'clientContext': {
|
'clientContext': {
|
||||||
'fmly': True,
|
'fmly': self.with_family,
|
||||||
'shouldLocate': True,
|
'shouldLocate': True,
|
||||||
'selectedDevice': 'all',
|
'selectedDevice': 'all',
|
||||||
}
|
}
|
||||||
|
@ -134,7 +135,7 @@ class AppleDevice(object):
|
||||||
'device': self.content['id'],
|
'device': self.content['id'],
|
||||||
'subject': subject,
|
'subject': subject,
|
||||||
'clientContext': {
|
'clientContext': {
|
||||||
'fmly': True
|
'fmly': self.with_family
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
self.session.post(
|
self.session.post(
|
||||||
|
|
Loading…
Reference in a new issue