summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/ChatgptLogin.py
diff options
context:
space:
mode:
authorHeiner Lohaus <heiner@lohaus.eu>2023-09-20 06:12:34 +0200
committerHeiner Lohaus <heiner@lohaus.eu>2023-09-20 06:12:34 +0200
commit82bd6f91808a383781807262c4ae1f3de9740531 (patch)
tree9a12306a3dda5e883bc21e13b2f50294892a2fc9 /g4f/Provider/ChatgptLogin.py
parent~ | Merge pull request #914 from hlohaus/lesh (diff)
downloadgpt4free-82bd6f91808a383781807262c4ae1f3de9740531.tar
gpt4free-82bd6f91808a383781807262c4ae1f3de9740531.tar.gz
gpt4free-82bd6f91808a383781807262c4ae1f3de9740531.tar.bz2
gpt4free-82bd6f91808a383781807262c4ae1f3de9740531.tar.lz
gpt4free-82bd6f91808a383781807262c4ae1f3de9740531.tar.xz
gpt4free-82bd6f91808a383781807262c4ae1f3de9740531.tar.zst
gpt4free-82bd6f91808a383781807262c4ae1f3de9740531.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/ChatgptLogin.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/g4f/Provider/ChatgptLogin.py b/g4f/Provider/ChatgptLogin.py
index 8b868f8e..3eb55a64 100644
--- a/g4f/Provider/ChatgptLogin.py
+++ b/g4f/Provider/ChatgptLogin.py
@@ -52,7 +52,14 @@ class ChatgptLogin(AsyncProvider):
}
async with session.post("https://opchatgpts.net/wp-admin/admin-ajax.php", data=data) as response:
response.raise_for_status()
- return (await response.json())["data"]
+ data = await response.json()
+ if "data" in data:
+ return data["data"]
+ elif "msg" in data:
+ raise RuntimeError(data["msg"])
+ else:
+ raise RuntimeError(f"Response: {data}")
+
@classmethod
@property