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
|
||||
def content(self):
|
||||
if self._cached is None:
|
||||
try:
|
||||
self._cached = self.raw.read()
|
||||
finally:
|
||||
self.raw.close()
|
||||
self.raw = None
|
||||
return self._cached
|
||||
|
|
Ładowanie…
Reference in New Issue