diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-01-10 10:34:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-10 10:34:56 +0100 |
commit | bee75be8e38d25c4568c641412a49b576d425b24 (patch) | |
tree | 63ea1505dbe2b84c3011164a7b2699e642d94c19 /g4f/requests.py | |
parent | Merge pull request #1441 from w453y/patch-1 (diff) | |
download | gpt4free-bee75be8e38d25c4568c641412a49b576d425b24.tar gpt4free-bee75be8e38d25c4568c641412a49b576d425b24.tar.gz gpt4free-bee75be8e38d25c4568c641412a49b576d425b24.tar.bz2 gpt4free-bee75be8e38d25c4568c641412a49b576d425b24.tar.lz gpt4free-bee75be8e38d25c4568c641412a49b576d425b24.tar.xz gpt4free-bee75be8e38d25c4568c641412a49b576d425b24.tar.zst gpt4free-bee75be8e38d25c4568c641412a49b576d425b24.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/requests.py | 5 |
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) |