diff options
author | Heiner Lohaus <heiner@lohaus.eu> | 2023-10-01 06:38:11 +0200 |
---|---|---|
committer | Heiner Lohaus <heiner@lohaus.eu> | 2023-10-01 06:38:11 +0200 |
commit | 98895e5b09ea5e3f19b2263ddca028c7b296abb2 (patch) | |
tree | 514883128a48dcd4d337a97d061f1fa5f1e1db4a /g4f/Provider/helper.py | |
parent | ~ | v-0.1.4.2 `pip install -U g4f` (diff) | |
download | gpt4free-98895e5b09ea5e3f19b2263ddca028c7b296abb2.tar gpt4free-98895e5b09ea5e3f19b2263ddca028c7b296abb2.tar.gz gpt4free-98895e5b09ea5e3f19b2263ddca028c7b296abb2.tar.bz2 gpt4free-98895e5b09ea5e3f19b2263ddca028c7b296abb2.tar.lz gpt4free-98895e5b09ea5e3f19b2263ddca028c7b296abb2.tar.xz gpt4free-98895e5b09ea5e3f19b2263ddca028c7b296abb2.tar.zst gpt4free-98895e5b09ea5e3f19b2263ddca028c7b296abb2.zip |
Diffstat (limited to 'g4f/Provider/helper.py')
-rw-r--r-- | g4f/Provider/helper.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/g4f/Provider/helper.py b/g4f/Provider/helper.py index e14ae65e..2c00a488 100644 --- a/g4f/Provider/helper.py +++ b/g4f/Provider/helper.py @@ -1,18 +1,12 @@ from __future__ import annotations import asyncio -import sys from asyncio import AbstractEventLoop import browser_cookie3 _cookies: dict[str, dict[str, str]] = {} -# Use own event_loop_policy with a selector event loop on windows. -if sys.platform == 'win32': - _event_loop_policy = asyncio.WindowsSelectorEventLoopPolicy() -else: - _event_loop_policy = asyncio.get_event_loop_policy() # If event loop is already running, handle nested event loops # If "nest_asyncio" is installed, patch the event loop. @@ -20,9 +14,9 @@ def get_event_loop() -> AbstractEventLoop: try: asyncio.get_running_loop() except RuntimeError: - return _event_loop_policy.get_event_loop() + return asyncio.get_event_loop() try: - event_loop = _event_loop_policy.get_event_loop() + event_loop = asyncio.get_event_loop() if not hasattr(event_loop.__class__, "_nest_patched"): import nest_asyncio nest_asyncio.apply(event_loop) |