Skip to content

Commit 6d52e4c

Browse files
authored
Merge pull request #166 from xoviat/patch-1
adapater: recover from zlib.error.
2 parents 54f5e5c + 606c06a commit 6d52e4c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cachecontrol/adapter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import types
22
import functools
3+
import zlib
34

45
from requests.adapters import HTTPAdapter
56

@@ -37,7 +38,10 @@ def send(self, request, cacheable_methods=None, **kw):
3738
"""
3839
cacheable = cacheable_methods or self.cacheable_methods
3940
if request.method in cacheable:
40-
cached_response = self.controller.cached_request(request)
41+
try:
42+
cached_response = self.controller.cached_request(request)
43+
except zlib.error:
44+
cached_response = None
4145
if cached_response:
4246
return self.build_response(request, cached_response,
4347
from_cache=True)

0 commit comments

Comments
 (0)