kopia lustrzana https://github.com/micropython/micropython-lib
urequests: content: Use finally to close socket regardless of possible error.
rodzic
586ae64cb0
commit
2e834672aa
|
@ -16,7 +16,9 @@ class Response:
|
||||||
@property
|
@property
|
||||||
def content(self):
|
def content(self):
|
||||||
if self._cached is None:
|
if self._cached is None:
|
||||||
|
try:
|
||||||
self._cached = self.raw.read()
|
self._cached = self.raw.read()
|
||||||
|
finally:
|
||||||
self.raw.close()
|
self.raw.close()
|
||||||
self.raw = None
|
self.raw = None
|
||||||
return self._cached
|
return self._cached
|
||||||
|
|
Ładowanie…
Reference in New Issue