From 4daa34f310c41d110f274ff2f4aaa7ca56676645 Mon Sep 17 00:00:00 2001 From: Adam Coddington Date: Wed, 13 May 2015 21:59:44 -0700 Subject: [PATCH] Cleaning up cookie handling to use a system-level temporary directory. Adding logger. --- pyicloud/base.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pyicloud/base.py b/pyicloud/base.py index bc83cc7..5b09657 100644 --- a/pyicloud/base.py +++ b/pyicloud/base.py @@ -1,9 +1,11 @@ import uuid import hashlib import json +import logging +import pickle import requests import sys -import pickle +import tempfile import os from re import match @@ -16,6 +18,9 @@ from pyicloud.services import ( ) +logger = logging.getLogger(__name__) + + class PyiCloudService(object): """ A base authentication class for the iCloud service. Handles the @@ -40,7 +45,10 @@ class PyiCloudService(object): self._base_system_url = '%s/system/version.json' % self._home_endpoint self._base_webauth_url = '%s/refreshWebAuth' % self._push_endpoint - self._cookie_directory = 'cookies' + self._cookie_directory = os.path.join( + tempfile.gettempdir(), + 'pyicloud', + ) self.session = requests.Session() self.session.verify = False