summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/MetaAI.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-04-21 15:15:55 +0200
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-04-21 15:15:55 +0200
commita26421bcd8b8580650fa05b3fb4f8fdfa0ef9921 (patch)
treeb1c7ff275c54682e29f89f07638b8fdd1743e0e1 /g4f/Provider/MetaAI.py
parentAdd MissingRequirementsError to You (diff)
downloadgpt4free-a26421bcd8b8580650fa05b3fb4f8fdfa0ef9921.tar
gpt4free-a26421bcd8b8580650fa05b3fb4f8fdfa0ef9921.tar.gz
gpt4free-a26421bcd8b8580650fa05b3fb4f8fdfa0ef9921.tar.bz2
gpt4free-a26421bcd8b8580650fa05b3fb4f8fdfa0ef9921.tar.lz
gpt4free-a26421bcd8b8580650fa05b3fb4f8fdfa0ef9921.tar.xz
gpt4free-a26421bcd8b8580650fa05b3fb4f8fdfa0ef9921.tar.zst
gpt4free-a26421bcd8b8580650fa05b3fb4f8fdfa0ef9921.zip
Diffstat (limited to 'g4f/Provider/MetaAI.py')
-rw-r--r--g4f/Provider/MetaAI.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/g4f/Provider/MetaAI.py b/g4f/Provider/MetaAI.py
index fb7790f9..045255e7 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(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")