Merge pull request #218 from ezeagwulae/contacts_fix
fix Contacts services to return iphone contacts
This commit is contained in:
commit
ec201f8e1a
1 changed files with 6 additions and 16 deletions
|
@ -9,6 +9,7 @@ class ContactsService(object):
|
||||||
"""
|
"""
|
||||||
The 'Contacts' iCloud service, connects to iCloud and returns contacts.
|
The 'Contacts' iCloud service, connects to iCloud and returns contacts.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, service_root, session, params):
|
def __init__(self, service_root, session, params):
|
||||||
self.session = session
|
self.session = session
|
||||||
self.params = params
|
self.params = params
|
||||||
|
@ -17,7 +18,7 @@ class ContactsService(object):
|
||||||
self._contacts_refresh_url = '%s/startup' % self._contacts_endpoint
|
self._contacts_refresh_url = '%s/startup' % self._contacts_endpoint
|
||||||
self._contacts_changeset_url = '%s/changeset' % self._contacts_endpoint
|
self._contacts_changeset_url = '%s/changeset' % self._contacts_endpoint
|
||||||
|
|
||||||
def refresh_client(self, from_dt=None, to_dt=None):
|
def refresh_client(self):
|
||||||
"""
|
"""
|
||||||
Refreshes the ContactsService endpoint, ensuring that the
|
Refreshes the ContactsService endpoint, ensuring that the
|
||||||
contacts data is up-to-date.
|
contacts data is up-to-date.
|
||||||
|
@ -25,23 +26,12 @@ class ContactsService(object):
|
||||||
params_contacts = dict(self.params)
|
params_contacts = dict(self.params)
|
||||||
params_contacts.update({
|
params_contacts.update({
|
||||||
'clientVersion': '2.1',
|
'clientVersion': '2.1',
|
||||||
'locale': 'en_US',
|
'locale': 'en_US',
|
||||||
'order': 'last,first',
|
'order': 'last,first',
|
||||||
})
|
})
|
||||||
req = self.session.get(
|
req = self.session.get(
|
||||||
self._contacts_refresh_url,
|
self._contacts_refresh_url,
|
||||||
params=params_contacts
|
params=params_contacts
|
||||||
)
|
|
||||||
self.response = req.json()
|
|
||||||
params_refresh = dict(self.params)
|
|
||||||
params_refresh.update({
|
|
||||||
'prefToken': req.json()["prefToken"],
|
|
||||||
'syncToken': req.json()["syncToken"],
|
|
||||||
})
|
|
||||||
self.session.post(self._contacts_changeset_url, params=params_refresh)
|
|
||||||
req = self.session.get(
|
|
||||||
self._contacts_refresh_url,
|
|
||||||
params=params_contacts
|
|
||||||
)
|
)
|
||||||
self.response = req.json()
|
self.response = req.json()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue