def read_headers(): if test == False: headers_file = generic_utility.headers_file() else: headers_file = 'headers' content = file_utility.read(headers_file) if len(content) > 0: return pickle.loads(content) else: generic_utility.log('warning, read empty headers-file') return None
def read_cookies(): if test == False: file_name = generic_utility.cookies_file() else: file_name = 'cookies' content = file_utility.read(file_name) if len(content) > 0: return requests.utils.cookiejar_from_dict(pickle.loads(content)) else: generic_utility.log('warning, read empty cookies-file') return None
def read_cookies(): if not test: file_name = generic_utility.cookies_file() else: file_name = 'cookies' content = file_utility.read(file_name) if len(content) > 0: loaded = pickle.loads(content) if type(loaded) == requests.cookies.RequestsCookieJar: return loaded else: return None else: generic_utility.log('warning, read empty cookies-file') return None