summaryrefslogtreecommitdiffstats
path: root/g4f/Provider
diff options
context:
space:
mode:
authorHeiner Lohaus <heiner@lohaus.eu>2023-10-01 20:29:57 +0200
committerHeiner Lohaus <heiner@lohaus.eu>2023-10-01 20:29:57 +0200
commit7b9ad21de81cd5129b047d8de3ce8d9e5a53ea9a (patch)
treeb6519bff3c7ee7a37189d67a3247d3db7a316c15 /g4f/Provider
parentDisable Wewordle Provider (diff)
downloadgpt4free-7b9ad21de81cd5129b047d8de3ce8d9e5a53ea9a.tar
gpt4free-7b9ad21de81cd5129b047d8de3ce8d9e5a53ea9a.tar.gz
gpt4free-7b9ad21de81cd5129b047d8de3ce8d9e5a53ea9a.tar.bz2
gpt4free-7b9ad21de81cd5129b047d8de3ce8d9e5a53ea9a.tar.lz
gpt4free-7b9ad21de81cd5129b047d8de3ce8d9e5a53ea9a.tar.xz
gpt4free-7b9ad21de81cd5129b047d8de3ce8d9e5a53ea9a.tar.zst
gpt4free-7b9ad21de81cd5129b047d8de3ce8d9e5a53ea9a.zip
Diffstat (limited to 'g4f/Provider')
-rw-r--r--g4f/Provider/helper.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/g4f/Provider/helper.py b/g4f/Provider/helper.py
index 2c00a488..544c5a76 100644
--- a/g4f/Provider/helper.py
+++ b/g4f/Provider/helper.py
@@ -1,13 +1,20 @@
from __future__ import annotations
-import asyncio
+import asyncio, sys
from asyncio import AbstractEventLoop
import browser_cookie3
+# Change event loop policy on windows
+if sys.platform == 'win32':
+ if isinstance(
+ asyncio.get_event_loop_policy(), asyncio.WindowsProactorEventLoopPolicy
+ ):
+ asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
+
+# Local Cookie Storage
_cookies: dict[str, dict[str, str]] = {}
-
# If event loop is already running, handle nested event loops
# If "nest_asyncio" is installed, patch the event loop.
def get_event_loop() -> AbstractEventLoop: