From 3732ca50cfd1eb3c1b6915909a900d56f979f475 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Wed, 10 Jun 2026 14:19:26 +0100 Subject: [PATCH] requests: Add context manager for response object. Signed-off-by: Phil Howard --- python-ecosys/requests/requests/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python-ecosys/requests/requests/__init__.py b/python-ecosys/requests/requests/__init__.py index 68b4b18cb..deb262cf5 100644 --- a/python-ecosys/requests/requests/__init__.py +++ b/python-ecosys/requests/requests/__init__.py @@ -32,6 +32,12 @@ def json(self): return json.loads(self.content) + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.close() + def request( method,