diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-04-22 01:35:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-22 01:35:07 +0200 |
commit | 4b4d1f08b5c75c8c8932b5edfbb0d020f8e029a7 (patch) | |
tree | 6ed0cfc6cd53a3ab32565d6199a929ac1ea6ad80 /g4f/Provider/MetaAI.py | |
parent | Merge pull request #1869 from hlohaus/carst (diff) | |
parent | Add vision models to readme (diff) | |
download | gpt4free-0.3.0.4.tar gpt4free-0.3.0.4.tar.gz gpt4free-0.3.0.4.tar.bz2 gpt4free-0.3.0.4.tar.lz gpt4free-0.3.0.4.tar.xz gpt4free-0.3.0.4.tar.zst gpt4free-0.3.0.4.zip |
Diffstat (limited to 'g4f/Provider/MetaAI.py')
-rw-r--r-- | g4f/Provider/MetaAI.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/g4f/Provider/MetaAI.py b/g4f/Provider/MetaAI.py index fb7790f9..caed7778 100644 --- a/g4f/Provider/MetaAI.py +++ b/g4f/Provider/MetaAI.py @@ -13,7 +13,7 @@ from ..requests import raise_for_status, DEFAULT_HEADERS from ..image import ImageResponse, ImagePreview from ..errors import ResponseError from .base_provider import AsyncGeneratorProvider -from .helper import format_prompt, get_connector +from .helper import format_prompt, get_connector, format_cookies class Sources(): def __init__(self, link_list: List[Dict[str, str]]) -> None: @@ -48,7 +48,6 @@ class MetaAI(AsyncGeneratorProvider): async def update_access_token(self, birthday: str = "1999-01-01"): url = "https://www.meta.ai/api/graphql/" - payload = { "lsd": self.lsd, "fb_api_caller_class": "RelayModern", @@ -90,7 +89,7 @@ class MetaAI(AsyncGeneratorProvider): headers = {} headers = { 'content-type': 'application/x-www-form-urlencoded', - 'cookie': "; ".join([f"{k}={v}" for k, v in cookies.items()]), + 'cookie': format_cookies(self.cookies), 'origin': 'https://www.meta.ai', 'referer': 'https://www.meta.ai/', 'x-asbd-id': '129477', @@ -194,7 +193,7 @@ class MetaAI(AsyncGeneratorProvider): **headers } async with self.session.post(url, headers=headers, cookies=self.cookies, data=payload) as response: - await raise_for_status(response) + await raise_for_status(response, "Fetch sources failed") text = await response.text() if "<h1>Something Went Wrong</h1>" in text: raise ResponseError("Response: Something Went Wrong") |