Merge pull request #53 from leres/master

Add optional verify parameter to allow verification of SSL certificates
This commit is contained in:
Adam Coddington 2015-10-20 23:43:08 -07:00
commit 80f6cd6dec

View file

@ -32,7 +32,7 @@ class PyiCloudService(object):
pyicloud = PyiCloudService('username@apple.com', 'password') pyicloud = PyiCloudService('username@apple.com', 'password')
pyicloud.iphone.location() pyicloud.iphone.location()
""" """
def __init__(self, apple_id, password, cookie_directory=None): def __init__(self, apple_id, password, cookie_directory=None, verify=False):
self.discovery = None self.discovery = None
self.client_id = str(uuid.uuid1()).upper() self.client_id = str(uuid.uuid1()).upper()
self.user = {'apple_id': apple_id, 'password': password} self.user = {'apple_id': apple_id, 'password': password}
@ -57,7 +57,7 @@ class PyiCloudService(object):
) )
self.session = requests.Session() self.session = requests.Session()
self.session.verify = False self.session.verify = verify
self.session.headers.update({ self.session.headers.update({
'host': 'setup.icloud.com', 'host': 'setup.icloud.com',
'origin': self._home_endpoint, 'origin': self._home_endpoint,