This PR is based on https://github.com/picklepete/pyicloud/pull/227 and therefore has all changes this PR has. Otherwise no breaking changes. I saw it as necessary to base my PR on this PR to reduce the risk of accidentally erasing family devices.
Proposed change
add function erase_device in AppleDevice class that takes an eraseToken for specified device and erases that device using it.
add function fmipWebAuthenticate in PyiCloudService that requests such a token from Apple for a device
add property canWipe to AppleDevice. This property specifies whether a device supports remote erasion
Type of change
[ ] Dependency upgrade
[ ] Bugfix (non-breaking change which fixes an issue)
[ ] New service (thank you!)
[x] New feature (which adds functionality to an existing service)
[ ] Breaking change (fix/feature causing existing functionality to break)
[ ] Code quality improvements to existing code or addition of tests
[ ] Documentation or code sample
Example of code:
Usage example:
This code loops through all your devices and prompts you to erase the first one that supports remote erasion
api.find_my_iphone.with_family = False
api.find_my_iphone.refresh_client()
for x in range(0,len(api.find_my_iphone.devices)):
currentDevice = api.find_my_iphone.device(x)
print("Device", currentDevice.name, "does support remote erasure: ", currentDevice.canWipe)
if (currentDevice.canWipe):
erasetoken = api.fmipWebAuthenticate(currentDevice)
print(erasetoken)
input("Submit anything to wipe device")
currentDevice.erase_device(text="",erasetoken=erasetoken)
break
Additional information
This PR fixes issue: implements proposal from #341
Checklist
[x] The code change is tested and works locally.
[x] Local tests pass. Your PR cannot be merged unless tests pass
[x] There is no commented out code in this PR.
[ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
Breaking change
This PR is based on https://github.com/picklepete/pyicloud/pull/227 and therefore has all changes this PR has. Otherwise no breaking changes. I saw it as necessary to base my PR on this PR to reduce the risk of accidentally erasing family devices.
Proposed change
Type of change
Example of code:
Usage example: This code loops through all your devices and prompts you to erase the first one that supports remote erasion
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: