summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/Phind.py
diff options
context:
space:
mode:
authorTekky <98614666+xtekky@users.noreply.github.com>2023-11-19 23:42:50 +0100
committerGitHub <noreply@github.com>2023-11-19 23:42:50 +0100
commiteeb26036cafd0f9778fadf68953f8fb10ce85d84 (patch)
treed56844a7a1ab9ee60686be11da137560a9d7bbf0 /g4f/Provider/Phind.py
parentMerge pull request #1267 from hlohaus/any (diff)
parentAdd Response Handler to OpenaiChat (diff)
downloadgpt4free-eeb26036cafd0f9778fadf68953f8fb10ce85d84.tar
gpt4free-eeb26036cafd0f9778fadf68953f8fb10ce85d84.tar.gz
gpt4free-eeb26036cafd0f9778fadf68953f8fb10ce85d84.tar.bz2
gpt4free-eeb26036cafd0f9778fadf68953f8fb10ce85d84.tar.lz
gpt4free-eeb26036cafd0f9778fadf68953f8fb10ce85d84.tar.xz
gpt4free-eeb26036cafd0f9778fadf68953f8fb10ce85d84.tar.zst
gpt4free-eeb26036cafd0f9778fadf68953f8fb10ce85d84.zip
Diffstat (limited to 'g4f/Provider/Phind.py')
-rw-r--r--g4f/Provider/Phind.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/g4f/Provider/Phind.py b/g4f/Provider/Phind.py
index 34abbe35..32f63665 100644
--- a/g4f/Provider/Phind.py
+++ b/g4f/Provider/Phind.py
@@ -5,7 +5,7 @@ from urllib.parse import quote
from ..typing import CreateResult, Messages
from .base_provider import BaseProvider
-from .helper import WebDriver, format_prompt, get_browser
+from .helper import WebDriver, WebDriverSession, format_prompt
class Phind(BaseProvider):
url = "https://www.phind.com"
@@ -21,13 +21,11 @@ class Phind(BaseProvider):
stream: bool,
proxy: str = None,
timeout: int = 120,
- browser: WebDriver = None,
+ web_driver: WebDriver = None,
creative_mode: bool = None,
**kwargs
) -> CreateResult:
- try:
- driver = browser if browser else get_browser("", False, proxy)
-
+ with WebDriverSession(web_driver, "", proxy=proxy) as driver:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
@@ -102,9 +100,4 @@ if(window._reader) {
elif chunk != "":
break
else:
- time.sleep(0.1)
- finally:
- if not browser:
- driver.close()
- time.sleep(0.1)
- driver.quit() \ No newline at end of file
+ time.sleep(0.1) \ No newline at end of file