From abdcef0a80086f41208a9a46660d8d8f8ef70239 Mon Sep 17 00:00:00 2001 From: Tomuxs Date: Sat, 9 Aug 2025 16:13:25 +0200 Subject: [PATCH] Fixed handle leak --- py34/scraper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/py34/scraper.py b/py34/scraper.py index a4f654a..4a7054a 100644 --- a/py34/scraper.py +++ b/py34/scraper.py @@ -16,7 +16,7 @@ class CaptchaException(Exception): def __init__(self, *argv: any): # Reset scraper global scraper - scraper = Scraper() + scraper.reset() # Construct the exception super().__init__(self, *argv) @@ -44,7 +44,11 @@ class Scraper: def _retry_get(self, url: str, body: bool) -> bytes | Response: return self._get(url, body=body) + def close(self): + self._scraper.close() + def reset(self): + self._scraper.close() self._scraper = CloudScraper() def get(self, url: str, retry: bool = True, body: bool = True):