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__(
|
||||
self, apple_id, password=None, cookie_directory=None, verify=True,
|
||||
client_id=None
|
||||
client_id=None, with_family=True
|
||||
):
|
||||
if password is None:
|
||||
password = get_password_from_keyring(apple_id)
|
||||
|
||||
self.data = {}
|
||||
self.client_id = client_id or str(uuid.uuid1()).upper()
|
||||
self.with_family = with_family
|
||||
self.user = {'apple_id': apple_id, 'password': password}
|
||||
|
||||
self._password_filter = PyiCloudPasswordFilter(password)
|
||||
|
@ -314,7 +315,8 @@ class PyiCloudService(object):
|
|||
return FindMyiPhoneServiceManager(
|
||||
service_root,
|
||||
self.session,
|
||||
self.params
|
||||
self.params,
|
||||
self.with_family
|
||||
)
|
||||
|
||||
@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.params = params
|
||||
self._service_root = service_root
|
||||
self._fmip_endpoint = '%s/fmipservice/client/web' % self._service_root
|
||||
self._fmip_refresh_url = '%s/refreshClient' % self._fmip_endpoint
|
||||
self._fmip_sound_url = '%s/playSound' % self._fmip_endpoint
|
||||
self._fmip_message_url = '%s/sendMessage' % self._fmip_endpoint
|
||||
self._fmip_lost_url = '%s/lostDevice' % self._fmip_endpoint
|
||||
self.with_family = with_family
|
||||
|
||||
fmip_endpoint = '%s/fmipservice/client/web' % service_root
|
||||
self._fmip_refresh_url = '%s/refreshClient' % fmip_endpoint
|
||||
self._fmip_sound_url = '%s/playSound' % fmip_endpoint
|
||||
self._fmip_message_url = '%s/sendMessage' % fmip_endpoint
|
||||
self._fmip_lost_url = '%s/lostDevice' % fmip_endpoint
|
||||
|
||||
self._devices = {}
|
||||
self.refresh_client()
|
||||
|
@ -39,7 +40,7 @@ class FindMyiPhoneServiceManager(object):
|
|||
data=json.dumps(
|
||||
{
|
||||
'clientContext': {
|
||||
'fmly': True,
|
||||
'fmly': self.with_family,
|
||||
'shouldLocate': True,
|
||||
'selectedDevice': 'all',
|
||||
}
|
||||
|
@ -134,7 +135,7 @@ class AppleDevice(object):
|
|||
'device': self.content['id'],
|
||||
'subject': subject,
|
||||
'clientContext': {
|
||||
'fmly': True
|
||||
'fmly': self.with_family
|
||||
}
|
||||
})
|
||||
self.session.post(
|
||||
|
|
Loading…
Reference in a new issue