Fix comment

This commit is contained in:
Quentin POLLET 2020-03-09 23:56:58 +01:00
parent 0d7d9e590b
commit ef4eba7cdd
4 changed files with 13 additions and 13 deletions

View file

@ -248,14 +248,14 @@ class PyiCloudService(object):
@property @property
def requires_2sa(self): def requires_2sa(self):
""" Returns True if two-step authentication is required.""" """Returns True if two-step authentication is required."""
return self.data.get('hsaChallengeRequired', False) \ return self.data.get('hsaChallengeRequired', False) \
and self.data['dsInfo'].get('hsaVersion', 0) >= 1 and self.data['dsInfo'].get('hsaVersion', 0) >= 1
# FIXME: Implement 2FA for hsaVersion == 2 # FIXME: Implement 2FA for hsaVersion == 2
@property @property
def trusted_devices(self): def trusted_devices(self):
""" Returns devices trusted for two-step authentication.""" """Returns devices trusted for two-step authentication."""
request = self.session.get( request = self.session.get(
'%s/listDevices' % self._setup_endpoint, '%s/listDevices' % self._setup_endpoint,
params=self.params params=self.params
@ -263,7 +263,7 @@ class PyiCloudService(object):
return request.json().get('devices') return request.json().get('devices')
def send_verification_code(self, device): def send_verification_code(self, device):
""" Requests that a verification code is sent to the given device""" """Requests that a verification code is sent to the given device."""
data = json.dumps(device) data = json.dumps(device)
request = self.session.post( request = self.session.post(
'%s/sendVerificationCode' % self._setup_endpoint, '%s/sendVerificationCode' % self._setup_endpoint,
@ -273,7 +273,7 @@ class PyiCloudService(object):
return request.json().get('success', False) return request.json().get('success', False)
def validate_verification_code(self, device, code): def validate_verification_code(self, device, code):
""" Verifies a verification code received on a trusted device""" """Verifies a verification code received on a trusted device."""
device.update({ device.update({
'verificationCode': code, 'verificationCode': code,
'trustBrowser': True 'trustBrowser': True
@ -309,7 +309,7 @@ class PyiCloudService(object):
@property @property
def devices(self): def devices(self):
""" Return all devices.""" """Return all devices."""
service_root = self._get_webservice_url('findme') service_root = self._get_webservice_url('findme')
return FindMyiPhoneServiceManager( return FindMyiPhoneServiceManager(
service_root, service_root,

View file

@ -7,7 +7,7 @@ from pyicloud.exceptions import PyiCloudNoDevicesException
class FindMyiPhoneServiceManager(object): class FindMyiPhoneServiceManager(object):
""" The 'Find my iPhone' iCloud service """The 'Find my iPhone' iCloud service
This connects to iCloud and return phone data including the near-realtime This connects to iCloud and return phone data including the near-realtime
latitude and longitude. latitude and longitude.
@ -28,7 +28,7 @@ class FindMyiPhoneServiceManager(object):
self.refresh_client() self.refresh_client()
def refresh_client(self): def refresh_client(self):
""" Refreshes the FindMyiPhoneService endpoint, """Refreshes the FindMyiPhoneService endpoint,
This ensures that the location data is up-to-date. This ensures that the location data is up-to-date.
@ -113,7 +113,7 @@ class AppleDevice(object):
return self.content['location'] return self.content['location']
def status(self, additional=[]): def status(self, additional=[]):
""" Returns status information for device. """Returns status information for device.
This returns only a subset of possible properties. This returns only a subset of possible properties.
""" """
@ -126,7 +126,7 @@ class AppleDevice(object):
return properties return properties
def play_sound(self, subject='Find My iPhone Alert'): def play_sound(self, subject='Find My iPhone Alert'):
""" Send a request to the device to play a sound. """Send a request to the device to play a sound.
It's possible to pass a custom message by changing the `subject`. It's possible to pass a custom message by changing the `subject`.
""" """
@ -147,7 +147,7 @@ class AppleDevice(object):
self, subject='Find My iPhone Alert', message="This is a note", self, subject='Find My iPhone Alert', message="This is a note",
sounds=False sounds=False
): ):
""" Send a request to the device to play a sound. """Send a request to the device to play a sound.
It's possible to pass a custom message by changing the `subject`. It's possible to pass a custom message by changing the `subject`.
""" """
@ -171,7 +171,7 @@ class AppleDevice(object):
text='This iPhone has been lost. Please call me.', text='This iPhone has been lost. Please call me.',
newpasscode="" newpasscode=""
): ):
""" Send a request to the device to trigger 'lost mode'. """Send a request to the device to trigger 'lost mode'.
The device will show the message in `text`, and if a number has The device will show the message in `text`, and if a number has
been passed, then the person holding the device can call been passed, then the person holding the device can call

View file

@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
class PhotosService(object): class PhotosService(object):
""" The 'Photos' iCloud service.""" """The 'Photos' iCloud service."""
SMART_FOLDERS = { SMART_FOLDERS = {
"All Photos": { "All Photos": {
"obj_type": "CPLAssetByAddedDate", "obj_type": "CPLAssetByAddedDate",

View file

@ -3,7 +3,7 @@ import sys
class UbiquityService(object): class UbiquityService(object):
""" The 'Ubiquity' iCloud service.""" """The 'Ubiquity' iCloud service."""
def __init__(self, service_root, session, params): def __init__(self, service_root, session, params):
self.session = session self.session = session