diff options
author | Heiner Lohaus <heiner@lohaus.eu> | 2023-10-01 20:29:57 +0200 |
---|---|---|
committer | Heiner Lohaus <heiner@lohaus.eu> | 2023-10-01 20:29:57 +0200 |
commit | 7b9ad21de81cd5129b047d8de3ce8d9e5a53ea9a (patch) | |
tree | b6519bff3c7ee7a37189d67a3247d3db7a316c15 /g4f/Provider | |
parent | Disable Wewordle Provider (diff) | |
download | gpt4free-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 '')
-rw-r--r-- | g4f/Provider/helper.py | 11 |
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: |