summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/openai
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-04-05 21:00:35 +0200
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-04-05 21:00:35 +0200
commit1e2cf48cbac7e8fa13882f41e023a67fd9f286b7 (patch)
treeb4ab92cd92c386b86cdeea1b4d80d3eec43eb02f /g4f/Provider/openai
parentFix Gemini Proxy Connect call failed (#1768) (diff)
downloadgpt4free-1e2cf48cbac7e8fa13882f41e023a67fd9f286b7.tar
gpt4free-1e2cf48cbac7e8fa13882f41e023a67fd9f286b7.tar.gz
gpt4free-1e2cf48cbac7e8fa13882f41e023a67fd9f286b7.tar.bz2
gpt4free-1e2cf48cbac7e8fa13882f41e023a67fd9f286b7.tar.lz
gpt4free-1e2cf48cbac7e8fa13882f41e023a67fd9f286b7.tar.xz
gpt4free-1e2cf48cbac7e8fa13882f41e023a67fd9f286b7.tar.zst
gpt4free-1e2cf48cbac7e8fa13882f41e023a67fd9f286b7.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/openai/har_file.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/g4f/Provider/openai/har_file.py b/g4f/Provider/openai/har_file.py
index 68fe7420..8936c131 100644
--- a/g4f/Provider/openai/har_file.py
+++ b/g4f/Provider/openai/har_file.py
@@ -11,6 +11,9 @@ from copy import deepcopy
from .crypt import decrypt, encrypt
from ...requests import StreamSession
+class NoValidHarFileError(Exception):
+ ...
+
class arkReq:
def __init__(self, arkURL, arkBx, arkHeader, arkBody, arkCookies, userAgent):
self.arkURL = arkURL
@@ -39,7 +42,7 @@ def readHAR():
if harPath:
break
if not harPath:
- raise RuntimeError("No .har file found")
+ raise NoValidHarFileError("No .har file found")
for path in harPath:
with open(path, 'rb') as file:
try:
@@ -54,7 +57,7 @@ def readHAR():
accessToken = json.loads(v["response"]["content"]["text"]).get("accessToken")
cookies = {c['name']: c['value'] for c in v['request']['cookies']}
if not accessToken:
- RuntimeError("No accessToken found in .har files")
+ raise NoValidHarFileError("No accessToken found in .har files")
if not chatArks:
return None, accessToken, cookies
return chatArks.pop(), accessToken, cookies
@@ -75,9 +78,6 @@ def parseHAREntry(entry) -> arkReq:
return tmpArk
def genArkReq(chatArk: arkReq) -> arkReq:
- if not chatArk:
- raise RuntimeError("No .har file with arkose found")
-
tmpArk: arkReq = deepcopy(chatArk)
if tmpArk is None or not tmpArk.arkBody or not tmpArk.arkHeader:
raise RuntimeError("The .har file is not valid")