hishel 0.0.30__tar.gz → 0.0.32__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.
- {hishel-0.0.30 → hishel-0.0.32}/CHANGELOG.md +10 -0
- {hishel-0.0.30 → hishel-0.0.32}/PKG-INFO +11 -1
- {hishel-0.0.30 → hishel-0.0.32}/hishel/__init__.py +1 -1
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_async/_storages.py +9 -6
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_controller.py +7 -5
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_sync/_storages.py +9 -6
- {hishel-0.0.30 → hishel-0.0.32}/.gitignore +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/LICENSE +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/README.md +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_async/__init__.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_async/_client.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_async/_mock.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_async/_pool.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_async/_transports.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_exceptions.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_files.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_headers.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_lfu_cache.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_s3.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_serializers.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_sync/__init__.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_sync/_client.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_sync/_mock.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_sync/_pool.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_sync/_transports.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_synchronization.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/_utils.py +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/hishel/py.typed +0 -0
- {hishel-0.0.30 → hishel-0.0.32}/pyproject.toml +0 -0
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.0.32 (27th Sep, 2024)
|
|
4
|
+
|
|
5
|
+
- Don't raise an exception if the `Date` header is not present. (#273)
|
|
6
|
+
|
|
7
|
+
## 0.0.31 (22nd Sep, 2024)
|
|
8
|
+
|
|
9
|
+
- Ignore file not found error when cleaning up a file storage. (#264)
|
|
10
|
+
- Fix `AssertionError` on `client.close()` when use SQLiteStorage. (#269)
|
|
11
|
+
- Fix ignored flags when use `force_cache`. (#271)
|
|
12
|
+
|
|
3
13
|
## 0.0.30 (12th July, 2024)
|
|
4
14
|
|
|
5
15
|
- Fix cache update on revalidation response with content (rfc9111 section 4.3.3) (#239)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: hishel
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.32
|
|
4
4
|
Summary: Persistent cache implementation for httpx and httpcore
|
|
5
5
|
Project-URL: Homepage, https://hishel.com
|
|
6
6
|
Project-URL: Source, https://github.com/karpetrosyan/hishel
|
|
@@ -175,6 +175,16 @@ Help us grow and continue developing good software for you ❤️
|
|
|
175
175
|
|
|
176
176
|
# Changelog
|
|
177
177
|
|
|
178
|
+
## 0.0.32 (27th Sep, 2024)
|
|
179
|
+
|
|
180
|
+
- Don't raise an exception if the `Date` header is not present. (#273)
|
|
181
|
+
|
|
182
|
+
## 0.0.31 (22nd Sep, 2024)
|
|
183
|
+
|
|
184
|
+
- Ignore file not found error when cleaning up a file storage. (#264)
|
|
185
|
+
- Fix `AssertionError` on `client.close()` when use SQLiteStorage. (#269)
|
|
186
|
+
- Fix ignored flags when use `force_cache`. (#271)
|
|
187
|
+
|
|
178
188
|
## 0.0.30 (12th July, 2024)
|
|
179
189
|
|
|
180
190
|
- Fix cache update on revalidation response with content (rfc9111 section 4.3.3) (#239)
|
|
@@ -227,10 +227,13 @@ class AsyncFileStorage(AsyncBaseStorage):
|
|
|
227
227
|
async with self._lock:
|
|
228
228
|
with os.scandir(self._base_path) as entries:
|
|
229
229
|
for entry in entries:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
230
|
+
try:
|
|
231
|
+
if entry.is_file():
|
|
232
|
+
age = time.time() - entry.stat().st_mtime
|
|
233
|
+
if age > self._ttl:
|
|
234
|
+
os.unlink(entry.path)
|
|
235
|
+
except FileNotFoundError: # pragma: no cover
|
|
236
|
+
pass
|
|
234
237
|
|
|
235
238
|
|
|
236
239
|
class AsyncSQLiteStorage(AsyncBaseStorage):
|
|
@@ -374,8 +377,8 @@ class AsyncSQLiteStorage(AsyncBaseStorage):
|
|
|
374
377
|
return self._serializer.loads(cached_response)
|
|
375
378
|
|
|
376
379
|
async def aclose(self) -> None: # pragma: no cover
|
|
377
|
-
|
|
378
|
-
|
|
380
|
+
if self._connection is not None:
|
|
381
|
+
await self._connection.close()
|
|
379
382
|
|
|
380
383
|
async def _remove_expired_caches(self) -> None:
|
|
381
384
|
assert self._connection
|
|
@@ -79,8 +79,10 @@ def get_heuristic_freshness(response: Response, clock: "BaseClock") -> int:
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
def get_age(response: Response, clock: "BaseClock") -> int:
|
|
82
|
-
if not header_presents(response.headers, b"date"):
|
|
83
|
-
|
|
82
|
+
if not header_presents(response.headers, b"date"):
|
|
83
|
+
# If the response does not have a date header, then it is impossible to calculate the age.
|
|
84
|
+
# Instead of raising an exception, we return infinity to be sure that the response is not considered fresh.
|
|
85
|
+
return float("inf") # type: ignore
|
|
84
86
|
|
|
85
87
|
date = parse_date(extract_header_values_decoded(response.headers, b"date")[0])
|
|
86
88
|
|
|
@@ -149,9 +151,6 @@ class Controller:
|
|
|
149
151
|
method = request.method.decode("ascii")
|
|
150
152
|
force_cache = request.extensions.get("force_cache", None)
|
|
151
153
|
|
|
152
|
-
if force_cache if force_cache is not None else self._force_cache:
|
|
153
|
-
return True
|
|
154
|
-
|
|
155
154
|
if response.status not in self._cacheable_status_codes:
|
|
156
155
|
return False
|
|
157
156
|
|
|
@@ -162,6 +161,9 @@ class Controller:
|
|
|
162
161
|
if method not in self._cacheable_methods:
|
|
163
162
|
return False
|
|
164
163
|
|
|
164
|
+
if force_cache if force_cache is not None else self._force_cache:
|
|
165
|
+
return True
|
|
166
|
+
|
|
165
167
|
response_cache_control = parse_cache_control(extract_header_values_decoded(response.headers, b"cache-control"))
|
|
166
168
|
request_cache_control = parse_cache_control(extract_header_values_decoded(request.headers, b"cache-control"))
|
|
167
169
|
|
|
@@ -227,10 +227,13 @@ class FileStorage(BaseStorage):
|
|
|
227
227
|
with self._lock:
|
|
228
228
|
with os.scandir(self._base_path) as entries:
|
|
229
229
|
for entry in entries:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
230
|
+
try:
|
|
231
|
+
if entry.is_file():
|
|
232
|
+
age = time.time() - entry.stat().st_mtime
|
|
233
|
+
if age > self._ttl:
|
|
234
|
+
os.unlink(entry.path)
|
|
235
|
+
except FileNotFoundError: # pragma: no cover
|
|
236
|
+
pass
|
|
234
237
|
|
|
235
238
|
|
|
236
239
|
class SQLiteStorage(BaseStorage):
|
|
@@ -374,8 +377,8 @@ class SQLiteStorage(BaseStorage):
|
|
|
374
377
|
return self._serializer.loads(cached_response)
|
|
375
378
|
|
|
376
379
|
def close(self) -> None: # pragma: no cover
|
|
377
|
-
|
|
378
|
-
|
|
380
|
+
if self._connection is not None:
|
|
381
|
+
self._connection.close()
|
|
379
382
|
|
|
380
383
|
def _remove_expired_caches(self) -> None:
|
|
381
384
|
assert self._connection
|
|
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
|