summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/helper.py
diff options
context:
space:
mode:
authorHeiner Lohaus <heiner@lohaus.eu>2023-10-01 06:38:11 +0200
committerHeiner Lohaus <heiner@lohaus.eu>2023-10-01 06:38:11 +0200
commit98895e5b09ea5e3f19b2263ddca028c7b296abb2 (patch)
tree514883128a48dcd4d337a97d061f1fa5f1e1db4a /g4f/Provider/helper.py
parent~ | v-0.1.4.2 `pip install -U g4f` (diff)
downloadgpt4free-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 '')
-rw-r--r--g4f/Provider/helper.py10
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)