CacheControl 0.12.13__tar.gz → 0.12.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {CacheControl-0.12.13 → CacheControl-0.12.14}/CacheControl.egg-info/PKG-INFO +1 -1
- {CacheControl-0.12.13 → CacheControl-0.12.14}/CacheControl.egg-info/requires.txt +1 -1
- {CacheControl-0.12.13 → CacheControl-0.12.14}/PKG-INFO +1 -1
- {CacheControl-0.12.13 → CacheControl-0.12.14}/cachecontrol/__init__.py +1 -1
- {CacheControl-0.12.13 → CacheControl-0.12.14}/cachecontrol/caches/file_cache.py +17 -7
- {CacheControl-0.12.13 → CacheControl-0.12.14}/setup.py +2 -2
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/conftest.cpython-310-pytest-7.3.1.pyc +0 -0
- CacheControl-0.12.14/tests/__pycache__/test_adapter.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_adapter.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_cache_control.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_cache_control.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_chunked_response.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_etag.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_etag.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_expires_heuristics.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_expires_heuristics.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_max_age.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_redirects.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_redirects.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_regressions.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_serialization.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_serialization.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_server_http_version.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_storage_filecache.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_storage_filecache.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_storage_redis.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_storage_redis.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_vary.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_vary.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/utils.cpython-310.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/utils.cpython-311.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/test_storage_filecache.py +18 -6
- CacheControl-0.12.13/tests/__pycache__/test_adapter.cpython-310-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/CacheControl.egg-info/SOURCES.txt +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/CacheControl.egg-info/dependency_links.txt +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/CacheControl.egg-info/entry_points.txt +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/CacheControl.egg-info/top_level.txt +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/LICENSE.txt +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/MANIFEST.in +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/README.rst +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/cachecontrol/_cmd.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/cachecontrol/adapter.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/cachecontrol/cache.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/cachecontrol/caches/__init__.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/cachecontrol/caches/redis_cache.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/cachecontrol/compat.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/cachecontrol/controller.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/cachecontrol/filewrapper.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/cachecontrol/heuristics.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/cachecontrol/serialize.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/cachecontrol/wrapper.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/setup.cfg +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__init__.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/__init__.cpython-310.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/__init__.cpython-311.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/__init__.cpython-39.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/conftest.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/conftest.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_adapter.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_cache_control.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_chunked_response.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_chunked_response.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_etag.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_expires_heuristics.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_max_age.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_max_age.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_redirects.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_regressions.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_regressions.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_serialization.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_server_http_version.cpython-311-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_server_http_version.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_storage_filecache.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_storage_redis.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/test_vary.cpython-39-pytest-7.3.1.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/utils.cpython-39.pyc +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/conftest.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/issue_263.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/test_adapter.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/test_cache_control.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/test_chunked_response.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/test_etag.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/test_expires_heuristics.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/test_max_age.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/test_redirects.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/test_regressions.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/test_serialization.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/test_server_http_version.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/test_storage_redis.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/test_vary.py +0 -0
- {CacheControl-0.12.13 → CacheControl-0.12.14}/tests/utils.py +0 -0
|
@@ -8,7 +8,7 @@ Make it easy to import from cachecontrol without long namespaces.
|
|
|
8
8
|
"""
|
|
9
9
|
__author__ = "Eric Larson"
|
|
10
10
|
__email__ = "eric@ionrock.org"
|
|
11
|
-
__version__ = "0.12.
|
|
11
|
+
__version__ = "0.12.14"
|
|
12
12
|
|
|
13
13
|
from .wrapper import CacheControl
|
|
14
14
|
from .adapter import CacheControlAdapter
|
|
@@ -66,23 +66,33 @@ class _FileCacheMixin:
|
|
|
66
66
|
forever=False,
|
|
67
67
|
filemode=0o0600,
|
|
68
68
|
dirmode=0o0700,
|
|
69
|
+
use_dir_lock=None,
|
|
69
70
|
lock_class=None,
|
|
70
71
|
):
|
|
71
72
|
|
|
73
|
+
if use_dir_lock is not None and lock_class is not None:
|
|
74
|
+
raise ValueError("Cannot use use_dir_lock and lock_class together")
|
|
75
|
+
|
|
72
76
|
try:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
lock_class = FileLock
|
|
77
|
+
from lockfile import LockFile
|
|
78
|
+
from lockfile.mkdirlockfile import MkdirLockFile
|
|
76
79
|
except ImportError:
|
|
77
80
|
notice = dedent(
|
|
78
81
|
"""
|
|
79
82
|
NOTE: In order to use the FileCache you must have
|
|
80
|
-
|
|
81
|
-
pip install
|
|
83
|
+
lockfile installed. You can install it via pip:
|
|
84
|
+
pip install lockfile
|
|
82
85
|
"""
|
|
83
86
|
)
|
|
84
87
|
raise ImportError(notice)
|
|
85
88
|
|
|
89
|
+
else:
|
|
90
|
+
if use_dir_lock:
|
|
91
|
+
lock_class = MkdirLockFile
|
|
92
|
+
|
|
93
|
+
elif lock_class is None:
|
|
94
|
+
lock_class = LockFile
|
|
95
|
+
|
|
86
96
|
self.directory = directory
|
|
87
97
|
self.forever = forever
|
|
88
98
|
self.filemode = filemode
|
|
@@ -123,9 +133,9 @@ class _FileCacheMixin:
|
|
|
123
133
|
except (IOError, OSError):
|
|
124
134
|
pass
|
|
125
135
|
|
|
126
|
-
with self.lock_class(path
|
|
136
|
+
with self.lock_class(path) as lock:
|
|
127
137
|
# Write our actual file
|
|
128
|
-
with _secure_open_write(path, self.filemode) as fh:
|
|
138
|
+
with _secure_open_write(lock.path, self.filemode) as fh:
|
|
129
139
|
fh.write(data)
|
|
130
140
|
|
|
131
141
|
def _delete(self, key, suffix):
|
|
@@ -6,7 +6,7 @@ import setuptools
|
|
|
6
6
|
|
|
7
7
|
long_description = open("README.rst").read()
|
|
8
8
|
|
|
9
|
-
VERSION = "0.12.
|
|
9
|
+
VERSION = "0.12.14"
|
|
10
10
|
|
|
11
11
|
setup_params = dict(
|
|
12
12
|
name="CacheControl",
|
|
@@ -22,7 +22,7 @@ setup_params = dict(
|
|
|
22
22
|
description="httplib2 caching for requests",
|
|
23
23
|
long_description=long_description,
|
|
24
24
|
install_requires=["requests", "msgpack>=0.5.2"],
|
|
25
|
-
extras_require={"filecache": ["
|
|
25
|
+
extras_require={"filecache": ["lockfile>=0.9"], "redis": ["redis>=2.10.5"]},
|
|
26
26
|
entry_points={"console_scripts": ["doesitcache = cachecontrol._cmd:main"]},
|
|
27
27
|
python_requires=">=3.6",
|
|
28
28
|
classifiers=[
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -14,7 +14,8 @@ import pytest
|
|
|
14
14
|
import requests
|
|
15
15
|
from cachecontrol import CacheControl
|
|
16
16
|
from cachecontrol.caches import FileCache, SeparateBodyFileCache
|
|
17
|
-
from
|
|
17
|
+
from lockfile import LockFile
|
|
18
|
+
from lockfile.mkdirlockfile import MkdirLockFile
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
def randomdata():
|
|
@@ -93,10 +94,21 @@ class FileCacheTestsMixin(object):
|
|
|
93
94
|
assert len(self.cache.encode(url0)) < 200
|
|
94
95
|
assert len(self.cache.encode(url0)) == len(self.cache.encode(url1))
|
|
95
96
|
|
|
96
|
-
def
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
def test_cant_use_dir_and_lock_class(self, tmpdir):
|
|
98
|
+
with pytest.raises(ValueError):
|
|
99
|
+
self.FileCacheClass(str(tmpdir), use_dir_lock=True, lock_class=object())
|
|
100
|
+
|
|
101
|
+
@pytest.mark.parametrize(
|
|
102
|
+
("value", "expected"),
|
|
103
|
+
[(None, LockFile), (True, MkdirLockFile), (False, LockFile)],
|
|
104
|
+
)
|
|
105
|
+
def test_simple_lockfile_arg(self, tmpdir, value, expected):
|
|
106
|
+
if value is not None:
|
|
107
|
+
cache = self.FileCacheClass(str(tmpdir), use_dir_lock=value)
|
|
108
|
+
else:
|
|
109
|
+
cache = self.FileCacheClass(str(tmpdir))
|
|
110
|
+
|
|
111
|
+
assert issubclass(cache.lock_class, expected)
|
|
100
112
|
cache.close()
|
|
101
113
|
|
|
102
114
|
def test_lock_class(self, tmpdir):
|
|
@@ -122,7 +134,7 @@ class TestFileCache(FileCacheTestsMixin):
|
|
|
122
134
|
"""
|
|
123
135
|
Tests for ``FileCache``.
|
|
124
136
|
"""
|
|
125
|
-
|
|
137
|
+
|
|
126
138
|
FileCacheClass = FileCache
|
|
127
139
|
|
|
128
140
|
def test_body_stored_inline(self, sess):
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{CacheControl-0.12.13 → CacheControl-0.12.14}/tests/__pycache__/conftest.cpython-39-pytest-7.3.1.pyc
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|