Allow user to specify cookie directory.
This commit is contained in:
parent
1a3a2bd616
commit
67030b0eba
1 changed files with 10 additions and 5 deletions
|
@ -31,7 +31,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):
|
def __init__(self, apple_id, password, cookie_directory=None):
|
||||||
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}
|
||||||
|
@ -45,6 +45,11 @@ class PyiCloudService(object):
|
||||||
self._base_system_url = '%s/system/version.json' % self._home_endpoint
|
self._base_system_url = '%s/system/version.json' % self._home_endpoint
|
||||||
self._base_webauth_url = '%s/refreshWebAuth' % self._push_endpoint
|
self._base_webauth_url = '%s/refreshWebAuth' % self._push_endpoint
|
||||||
|
|
||||||
|
if cookie_directory:
|
||||||
|
self._cookie_directory = os.path.expanduser(
|
||||||
|
os.path.normpath(cookie_directory)
|
||||||
|
)
|
||||||
|
else:
|
||||||
self._cookie_directory = os.path.join(
|
self._cookie_directory = os.path.join(
|
||||||
tempfile.gettempdir(),
|
tempfile.gettempdir(),
|
||||||
'pyicloud',
|
'pyicloud',
|
||||||
|
|
Loading…
Reference in a new issue