mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-11-23 00:22:09 +03:00
Update ChatgptFree.py
This commit is contained in:
parent
cab64a7fb4
commit
a0e826fcff
@ -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"]
|
Loading…
Reference in New Issue
Block a user