From 6c02766000810f33497843fabcebdecf2150e6f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=AF=E5=A4=A7=E4=BE=A0?= Date: Thu, 3 Jul 2025 18:38:48 +0800 Subject: [PATCH] =?UTF-8?q?AutoCloseResponse=E6=94=AF=E6=8C=81=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=96=87=E7=AE=A1=E7=90=86=E5=8D=8F=E8=AE=AE=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E9=83=A8=E5=88=86=E6=8F=92=E4=BB=B6=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/utils/http.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/utils/http.py b/app/utils/http.py index c647046e..6ca594c9 100644 --- a/app/utils/http.py +++ b/app/utils/http.py @@ -80,6 +80,12 @@ class AutoCloseResponse: for name, value in state.items(): setattr(self, name, value) + def __enter__(self): + return self + + def __exit__(self, *args): + self.close() + class RequestUtils: def __init__(self,