Skip to content

🕷️ 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

feat: spiders use uvloop/winloop when available

Karim shoair0bfdab715867
diff --git a/scrapling/spiders/spider.py b/scrapling/spiders/spider.py
index a111cd6..fbaa5f4 100644
--- a/scrapling/spiders/spider.py
+++ b/scrapling/spiders/spider.py
@@ -203,4 +203,7 @@ class Spider(ABC):
: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})
return anyio.run(self.__run, backend="asyncio", backend_options=backend_options)