We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents bc43a32 + e1e20d7 commit dc4e179Copy full SHA for dc4e179
cachecontrol/caches/file_cache.py
@@ -9,7 +9,7 @@
9
FileNotFoundError
10
except NameError:
11
# py2.X
12
- FileNotFoundError = OSError
+ FileNotFoundError = (IOError, OSError)
13
14
15
def _secure_open_write(filename, fmode):
@@ -95,12 +95,12 @@ def _fn(self, name):
95
96
def get(self, key):
97
name = self._fn(key)
98
- if not os.path.exists(name):
+ try:
99
+ with open(name, 'rb') as fh:
100
+ return fh.read()
101
+ except FileNotFoundError:
102
return None
103
- with open(name, 'rb') as fh:
- return fh.read()
-
104
def set(self, key, value):
105
106
0 commit comments