Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- from pyicloud import PyiCloudService
- if api.requires_2fa:
- import click
- print "Two-factor authentication required. Your trusted devices are:"
- devices = api.trusted_devices
- for i, device in enumerate(devices):
- print " %s: %s" % (i, device.get('deviceName',
- "SMS to %s" % device.get('phoneNumber')))
- device = click.prompt('Which device would you like to use?', default=0)
- device = devices[device]
- if not api.send_verification_code(device):
- print "Failed to send verification code"
- sys.exit(1)
- code = click.prompt('Please enter validation code')
- if not api.validate_verification_code(device, code):
- print "Failed to verify verification code"
- sys.exit(1)
- print(api.iphone.status()['batteryLevel'])
Advertisement
Add Comment
Please, Sign In to add comment