Fixed handle leak
This commit is contained in:
@ -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):
|
||||
|
||||
Reference in New Issue
Block a user