Adding the Find My iPhone 'lost mode' method.
This commit is contained in:
parent
5930e27188
commit
b249554119
1 changed files with 21 additions and 0 deletions
21
services/findmyiphone.py
Normal file → Executable file
21
services/findmyiphone.py
Normal file → Executable file
|
@ -15,6 +15,7 @@ class FindMyiPhoneService(object):
|
||||||
self._fmip_endpoint = '%s/fmipservice/client/web' % self._service_root
|
self._fmip_endpoint = '%s/fmipservice/client/web' % self._service_root
|
||||||
self._fmip_refresh_url = '%s/refreshClient' % self._fmip_endpoint
|
self._fmip_refresh_url = '%s/refreshClient' % self._fmip_endpoint
|
||||||
self._fmip_sound_url = '%s/playSound' % self._fmip_endpoint
|
self._fmip_sound_url = '%s/playSound' % self._fmip_endpoint
|
||||||
|
self._fmip_lost_url = '%s/lostDevice' % self._fmip_endpoint
|
||||||
|
|
||||||
def refresh_client(self):
|
def refresh_client(self):
|
||||||
"""
|
"""
|
||||||
|
@ -58,3 +59,23 @@ class FindMyiPhoneService(object):
|
||||||
self.refresh_client()
|
self.refresh_client()
|
||||||
data = json.dumps({'device': self.content['id'], 'subject': subject})
|
data = json.dumps({'device': self.content['id'], 'subject': subject})
|
||||||
self.session.post(self._fmip_sound_url, params=self.params, data=data)
|
self.session.post(self._fmip_sound_url, params=self.params, data=data)
|
||||||
|
|
||||||
|
def lost_device(self, number, text=None):
|
||||||
|
"""
|
||||||
|
Send a request to the device to trigger 'lost mode'. The
|
||||||
|
device will show the message in `text`, and if a number has
|
||||||
|
been passed, then the person holding the device can call
|
||||||
|
the number without entering the passcode.
|
||||||
|
"""
|
||||||
|
self.refresh_client()
|
||||||
|
if not text:
|
||||||
|
text = 'This iPhone has been lost. Please call me.'
|
||||||
|
data = json.dumps({
|
||||||
|
'text': text,
|
||||||
|
'userText': True,
|
||||||
|
'ownerNbr': number,
|
||||||
|
'lostModeEnabled': True,
|
||||||
|
'trackingEnabled': True,
|
||||||
|
'device': self.content['id'],
|
||||||
|
})
|
||||||
|
self.session.post(self._fmip_lost_url, params=self.params, data=data)
|
||||||
|
|
Loading…
Reference in a new issue