Cleaning up cookie handling to use a system-level temporary directory. Adding logger.

This commit is contained in:
Adam Coddington 2015-05-13 21:59:44 -07:00
parent 897f905855
commit 4daa34f310

View file

@ -1,9 +1,11 @@
import uuid import uuid
import hashlib import hashlib
import json import json
import logging
import pickle
import requests import requests
import sys import sys
import pickle import tempfile
import os import os
from re import match from re import match
@ -16,6 +18,9 @@ from pyicloud.services import (
) )
logger = logging.getLogger(__name__)
class PyiCloudService(object): class PyiCloudService(object):
""" """
A base authentication class for the iCloud service. Handles the 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_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
self._cookie_directory = 'cookies' self._cookie_directory = os.path.join(
tempfile.gettempdir(),
'pyicloud',
)
self.session = requests.Session() self.session = requests.Session()
self.session.verify = False self.session.verify = False