diff --git a/pyicloud/base.py b/pyicloud/base.py index 23e774e..739e7bc 100644 --- a/pyicloud/base.py +++ b/pyicloud/base.py @@ -8,7 +8,8 @@ from pyicloud.exceptions import PyiCloudFailedLoginException from pyicloud.services import ( FindMyiPhoneServiceManager, CalendarService, - UbiquityService + UbiquityService, + ContactsService ) @@ -72,6 +73,12 @@ class PyiCloudService(object): ) self.params.update({'id': sha.hexdigest().upper()}) + clientId = str(uuid.uuid1()).upper() + self.params.update({ + 'clientBuildNumber': '14E45', + 'clientId': clientId, + }) + def authenticate(self): """ Handles the full authentication steps, validating, @@ -126,6 +133,11 @@ class PyiCloudService(object): service_root = self.webservices['calendar']['url'] return CalendarService(service_root, self.session, self.params) + @property + def contacts(self): + service_root = self.webservices['contacts']['url'] + return ContactsService(service_root, self.session, self.params) + def __unicode__(self): return 'iCloud API: %s' % self.user.get('apple_id') diff --git a/pyicloud/services/__init__.py b/pyicloud/services/__init__.py index 3911d9b..4befaf7 100644 --- a/pyicloud/services/__init__.py +++ b/pyicloud/services/__init__.py @@ -1,3 +1,4 @@ from pyicloud.services.calendar import CalendarService from pyicloud.services.findmyiphone import FindMyiPhoneServiceManager from pyicloud.services.ubiquity import UbiquityService +from contacts import ContactsService