summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/helper.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-01-02 01:10:31 +0100
committerGitHub <noreply@github.com>2024-01-02 01:10:31 +0100
commitb1b8ed40a4e8c7c3490b1c6b7cf6b55d0776f366 (patch)
tree6cd09fb2eb4c144e28a82759a2a9a2fa7f30d311 /g4f/Provider/helper.py
parentMerge pull request #1414 from hlohaus/lia (diff)
parentFix markdown replace (diff)
downloadgpt4free-b1b8ed40a4e8c7c3490b1c6b7cf6b55d0776f366.tar
gpt4free-b1b8ed40a4e8c7c3490b1c6b7cf6b55d0776f366.tar.gz
gpt4free-b1b8ed40a4e8c7c3490b1c6b7cf6b55d0776f366.tar.bz2
gpt4free-b1b8ed40a4e8c7c3490b1c6b7cf6b55d0776f366.tar.lz
gpt4free-b1b8ed40a4e8c7c3490b1c6b7cf6b55d0776f366.tar.xz
gpt4free-b1b8ed40a4e8c7c3490b1c6b7cf6b55d0776f366.tar.zst
gpt4free-b1b8ed40a4e8c7c3490b1c6b7cf6b55d0776f366.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/helper.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/g4f/Provider/helper.py b/g4f/Provider/helper.py
index ded59ee2..81f417dd 100644
--- a/g4f/Provider/helper.py
+++ b/g4f/Provider/helper.py
@@ -1,6 +1,5 @@
from __future__ import annotations
-import sys
import asyncio
import webbrowser
import random
@@ -8,7 +7,7 @@ import string
import secrets
import os
from os import path
-from asyncio import AbstractEventLoop
+from asyncio import AbstractEventLoop, BaseEventLoop
from platformdirs import user_config_dir
from browser_cookie3 import (
chrome,
@@ -34,7 +33,8 @@ _cookies: Dict[str, Dict[str, str]] = {}
def get_event_loop() -> AbstractEventLoop:
try:
loop = asyncio.get_event_loop()
- loop._check_closed()
+ if isinstance(loop, BaseEventLoop):
+ loop._check_closed()
except RuntimeError:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)