hishel 1.1.4__tar.gz → 1.1.5__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.
Files changed (26) hide show
  1. {hishel-1.1.4 → hishel-1.1.5}/CHANGELOG.md +10 -0
  2. {hishel-1.1.4 → hishel-1.1.5}/PKG-INFO +11 -1
  3. {hishel-1.1.4 → hishel-1.1.5}/hishel/_core/_storages/_async_sqlite.py +13 -10
  4. {hishel-1.1.4 → hishel-1.1.5}/hishel/_core/_storages/_sync_sqlite.py +13 -10
  5. {hishel-1.1.4 → hishel-1.1.5}/pyproject.toml +1 -1
  6. {hishel-1.1.4 → hishel-1.1.5}/.gitignore +0 -0
  7. {hishel-1.1.4 → hishel-1.1.5}/LICENSE +0 -0
  8. {hishel-1.1.4 → hishel-1.1.5}/README.md +0 -0
  9. {hishel-1.1.4 → hishel-1.1.5}/hishel/__init__.py +0 -0
  10. {hishel-1.1.4 → hishel-1.1.5}/hishel/_async_cache.py +0 -0
  11. {hishel-1.1.4 → hishel-1.1.5}/hishel/_async_httpx.py +0 -0
  12. {hishel-1.1.4 → hishel-1.1.5}/hishel/_core/_headers.py +0 -0
  13. {hishel-1.1.4 → hishel-1.1.5}/hishel/_core/_spec.py +0 -0
  14. {hishel-1.1.4 → hishel-1.1.5}/hishel/_core/_storages/_async_base.py +0 -0
  15. {hishel-1.1.4 → hishel-1.1.5}/hishel/_core/_storages/_packing.py +0 -0
  16. {hishel-1.1.4 → hishel-1.1.5}/hishel/_core/_storages/_sync_base.py +0 -0
  17. {hishel-1.1.4 → hishel-1.1.5}/hishel/_core/models.py +0 -0
  18. {hishel-1.1.4 → hishel-1.1.5}/hishel/_policies.py +0 -0
  19. {hishel-1.1.4 → hishel-1.1.5}/hishel/_sync_cache.py +0 -0
  20. {hishel-1.1.4 → hishel-1.1.5}/hishel/_sync_httpx.py +0 -0
  21. {hishel-1.1.4 → hishel-1.1.5}/hishel/_utils.py +0 -0
  22. {hishel-1.1.4 → hishel-1.1.5}/hishel/asgi.py +0 -0
  23. {hishel-1.1.4 → hishel-1.1.5}/hishel/fastapi.py +0 -0
  24. {hishel-1.1.4 → hishel-1.1.5}/hishel/httpx.py +0 -0
  25. {hishel-1.1.4 → hishel-1.1.5}/hishel/py.typed +0 -0
  26. {hishel-1.1.4 → hishel-1.1.5}/hishel/requests.py +0 -0
@@ -1,3 +1,13 @@
1
+ ## What's Changed in 1.1.5
2
+ ### 🐛 Bug Fixes
3
+
4
+ * filter out soft-deleted, expired and incomplete entries in `get_entries` by @karpetrosyan
5
+
6
+ ### Contributors
7
+ * @karpetrosyan
8
+
9
+ **Full Changelog**: https://github.com/karpetrosyan/hishel/compare/1.1.4...1.1.5
10
+
1
11
  ## What's Changed in 1.1.4
2
12
  ### 🐛 Bug Fixes
3
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hishel
3
- Version: 1.1.4
3
+ Version: 1.1.5
4
4
  Summary: Elegant HTTP Caching for Python
5
5
  Project-URL: Homepage, https://hishel.com
6
6
  Project-URL: Source, https://github.com/karpetrosyan/hishel
@@ -406,6 +406,16 @@ Hishel is inspired by and builds upon the excellent work in the Python HTTP ecos
406
406
  <strong>Made with ❤️ by <a href="https://github.com/karpetrosyan">Kar Petrosyan</a></strong>
407
407
  </p>
408
408
 
409
+ ## What's Changed in 1.1.5
410
+ ### 🐛 Bug Fixes
411
+
412
+ * filter out soft-deleted, expired and incomplete entries in `get_entries` by @karpetrosyan
413
+
414
+ ### Contributors
415
+ * @karpetrosyan
416
+
417
+ **Full Changelog**: https://github.com/karpetrosyan/hishel/compare/1.1.4...1.1.5
418
+
409
419
  ## What's Changed in 1.1.4
410
420
  ### 🐛 Bug Fixes
411
421
 
@@ -161,8 +161,19 @@ try:
161
161
  for row in await cursor.fetchall():
162
162
  pair_data = unpack(row[1], kind="pair")
163
163
 
164
+ if pair_data is None:
165
+ continue
166
+
164
167
  # Skip entries without a response (incomplete)
165
- if not isinstance(pair_data, Entry) or pair_data.response is None:
168
+ if not await self._is_stream_complete(pair_data.id, cursor=cursor):
169
+ continue
170
+
171
+ # Skip expired entries
172
+ if await self._is_pair_expired(pair_data, cursor=cursor):
173
+ continue
174
+
175
+ # Skip soft-deleted entries
176
+ if self.is_soft_deleted(pair_data):
166
177
  continue
167
178
 
168
179
  final_pairs.append(pair_data)
@@ -330,15 +341,7 @@ try:
330
341
 
331
342
  async def _is_corrupted(self, pair: Entry, cursor: anysqlite.Cursor) -> bool:
332
343
  # if entry was created more than 1 hour ago and still has no response (incomplete)
333
- if pair.meta.created_at + 3600 < time.time() and pair.response is None:
334
- return True
335
-
336
- # Check if response stream is complete for Entry with response
337
- if (
338
- isinstance(pair, Entry)
339
- and pair.response is not None
340
- and not await self._is_stream_complete(pair.id, cursor)
341
- ):
344
+ if pair.meta.created_at + 3600 < time.time() and not self._is_stream_complete(pair.id, cursor):
342
345
  return True
343
346
  return False
344
347
 
@@ -161,8 +161,19 @@ try:
161
161
  for row in cursor.fetchall():
162
162
  pair_data = unpack(row[1], kind="pair")
163
163
 
164
+ if pair_data is None:
165
+ continue
166
+
164
167
  # Skip entries without a response (incomplete)
165
- if not isinstance(pair_data, Entry) or pair_data.response is None:
168
+ if not self._is_stream_complete(pair_data.id, cursor=cursor):
169
+ continue
170
+
171
+ # Skip expired entries
172
+ if self._is_pair_expired(pair_data, cursor=cursor):
173
+ continue
174
+
175
+ # Skip soft-deleted entries
176
+ if self.is_soft_deleted(pair_data):
166
177
  continue
167
178
 
168
179
  final_pairs.append(pair_data)
@@ -330,15 +341,7 @@ try:
330
341
 
331
342
  def _is_corrupted(self, pair: Entry, cursor: sqlite3.Cursor) -> bool:
332
343
  # if entry was created more than 1 hour ago and still has no response (incomplete)
333
- if pair.meta.created_at + 3600 < time.time() and pair.response is None:
334
- return True
335
-
336
- # Check if response stream is complete for Entry with response
337
- if (
338
- isinstance(pair, Entry)
339
- and pair.response is not None
340
- and not self._is_stream_complete(pair.id, cursor)
341
- ):
344
+ if pair.meta.created_at + 3600 < time.time() and not self._is_stream_complete(pair.id, cursor):
342
345
  return True
343
346
  return False
344
347
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "hishel"
7
- version = "1.1.4"
7
+ version = "1.1.5"
8
8
  dynamic = ["readme"]
9
9
  description = " Elegant HTTP Caching for Python"
10
10
  license = "BSD-3-Clause"
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