Created
January 13, 2021 19:09
-
-
Save Santhin/69eaf42555a7559c4d1406e99410e299 to your computer and use it in GitHub Desktop.
asyncio reactor installation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# asyncio reactor installation (CORRECT) - `reactor` must not be defined at this point | |
# https://docs.scrapy.org/en/latest/_modules/scrapy/utils/reactor.html?highlight=asyncio%20reactor# | |
import scrapy | |
import asyncio | |
from twisted.internet import asyncioreactor | |
scrapy.utils.reactor.install_reactor('twisted.internet.asyncioreactor.AsyncioSelectorReactor') | |
is_asyncio_reactor_installed = scrapy.utils.reactor.is_asyncio_reactor_installed() | |
print(f"Is asyncio reactor installed: {is_asyncio_reactor_installed}") | |
from twisted.internet import reactor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment