🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
Python aiai-scrapingautomationcrawlercrawlingcrawling-pythondatadata-extractionmcpmcp-serverplaywrightpythonscrapingselectorsstealthweb-scraperweb-scrapingweb-scraping-pythonwebscrapingxpath
style(spiders): make the usage of uvloop optional
Karim shoair774364b6d35b
diff --git a/scrapling/spiders/spider.py b/scrapling/spiders/spider.pyindex fbaa5f4..5c51071 100644--- a/scrapling/spiders/spider.py+++ b/scrapling/spiders/spider.py@@ -195,15 +195,16 @@ class Spider(ABC):if isinstance(handler, logging.FileHandler):handler.close()- def start(self, backend_options: Dict[str, Any] | None = None) -> CrawlResult:+ def start(self, use_uvloop: bool = False, **backend_options: Any) -> CrawlResult:"""Run the spider and return results.This is the main entry point for running a spider.Handles async execution internally via anyio.+ :param use_uvloop: Whether to use the faster uvloop/winloop event loop implementation, if available.:param backend_options: Asyncio backend options to be used with `anyio.run`"""backend_options = backend_options or {}- # By default use the faster uvloop/winloop event loop implementation, if available- backend_options.update({"use_uvloop": True})+ if use_uvloop:+ backend_options.update({"use_uvloop": True})return anyio.run(self.__run, backend="asyncio", backend_options=backend_options)