summaryrefslogtreecommitdiffstats
path: root/g4f/requests.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-03 16:02:06 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-03 16:02:06 +0100
commit25895eb63799a1c38a40f03a48e85cdd8e9dc4b9 (patch)
tree2e1a35054f01c91298993c777b7756cdd9d7bae9 /g4f/requests.py
parentNew Provider 'Bestim' (#1416) (diff)
downloadgpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.tar
gpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.tar.gz
gpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.tar.bz2
gpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.tar.lz
gpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.tar.xz
gpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.tar.zst
gpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.zip
Diffstat (limited to 'g4f/requests.py')
-rw-r--r--g4f/requests.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/g4f/requests.py b/g4f/requests.py
index 00ab9488..467ea371 100644
--- a/g4f/requests.py
+++ b/g4f/requests.py
@@ -6,7 +6,7 @@ from functools import partialmethod
from typing import AsyncGenerator
from urllib.parse import urlparse
from curl_cffi.requests import AsyncSession, Session, Response
-from .webdriver import WebDriver, WebDriverSession, bypass_cloudflare
+from .webdriver import WebDriver, WebDriverSession, bypass_cloudflare, get_driver_cookies
class StreamResponse:
def __init__(self, inner: Response) -> None:
@@ -56,8 +56,7 @@ class StreamSession(AsyncSession):
def get_session_from_browser(url: str, webdriver: WebDriver = None, proxy: str = None, timeout: int = 120):
with WebDriverSession(webdriver, "", proxy=proxy, virtual_display=True) as driver:
bypass_cloudflare(driver, url, timeout)
-
- cookies = dict([(cookie["name"], cookie["value"]) for cookie in driver.get_cookies()])
+ cookies = get_driver_cookies(driver)
user_agent = driver.execute_script("return navigator.userAgent")
parse = urlparse(url)