Update ChatgptFree.py

This commit is contained in:
H Lohaus 2024-04-06 23:44:08 +02:00 committed by GitHub
parent cab64a7fb4
commit a0e826fcff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,7 +2,7 @@ from __future__ import annotations
import re
from ..requests import StreamSession
from ..requests import StreamSession, raise_for_status
from ..typing import Messages
from .base_provider import AsyncProvider
from .helper import format_prompt
@ -50,7 +50,7 @@ class ChatgptFree(AsyncProvider):
if not cls._nonce:
async with session.get(f"{cls.url}/") as response:
response.raise_for_status()
await raise_for_status(response)
response = await response.text()
result = re.search(r'data-post-id="([0-9]+)"', response)
@ -75,5 +75,5 @@ class ChatgptFree(AsyncProvider):
"bot_id": "0"
}
async with session.post(f"{cls.url}/wp-admin/admin-ajax.php", data=data, cookies=cookies) as response:
response.raise_for_status()
await raise_for_status(response)
return (await response.json())["data"]