|
|
@ -19,8 +19,13 @@ else:
|
|
|
|
|
|
|
|
|
|
|
|
# Set Windows event loop policy for better compatibility with asyncio and curl_cffi
|
|
|
|
# Set Windows event loop policy for better compatibility with asyncio and curl_cffi
|
|
|
|
if sys.platform == 'win32':
|
|
|
|
if sys.platform == 'win32':
|
|
|
|
if isinstance(asyncio.get_event_loop_policy(), asyncio.WindowsProactorEventLoopPolicy):
|
|
|
|
try:
|
|
|
|
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
|
|
|
from curl_cffi import aio
|
|
|
|
|
|
|
|
if not hasattr(aio, "_get_selector"):
|
|
|
|
|
|
|
|
if isinstance(asyncio.get_event_loop_policy(), asyncio.WindowsProactorEventLoopPolicy):
|
|
|
|
|
|
|
|
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
|
|
|
|
|
|
|
except ImportError:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def get_running_loop(check_nested: bool) -> Union[AbstractEventLoop, None]:
|
|
|
|
def get_running_loop(check_nested: bool) -> Union[AbstractEventLoop, None]:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|