summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/openai
diff options
context:
space:
mode:
authorochen1 <59662605+ochen1@users.noreply.github.com>2024-04-09 00:07:07 +0200
committerGitHub <noreply@github.com>2024-04-09 00:07:07 +0200
commit8c7292035e67d634b0bbb1eef4d2f79d3d58c5b7 (patch)
tree45470479cff8f8b41162ef455a66bd477d3d6f30 /g4f/Provider/openai
parentUpdate unittest.yml (diff)
downloadgpt4free-8c7292035e67d634b0bbb1eef4d2f79d3d58c5b7.tar
gpt4free-8c7292035e67d634b0bbb1eef4d2f79d3d58c5b7.tar.gz
gpt4free-8c7292035e67d634b0bbb1eef4d2f79d3d58c5b7.tar.bz2
gpt4free-8c7292035e67d634b0bbb1eef4d2f79d3d58c5b7.tar.lz
gpt4free-8c7292035e67d634b0bbb1eef4d2f79d3d58c5b7.tar.xz
gpt4free-8c7292035e67d634b0bbb1eef4d2f79d3d58c5b7.tar.zst
gpt4free-8c7292035e67d634b0bbb1eef4d2f79d3d58c5b7.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/openai/har_file.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/g4f/Provider/openai/har_file.py b/g4f/Provider/openai/har_file.py
index 8936c131..52cd8260 100644
--- a/g4f/Provider/openai/har_file.py
+++ b/g4f/Provider/openai/har_file.py
@@ -54,7 +54,10 @@ def readHAR():
if arkPreURL in v['request']['url']:
chatArks.append(parseHAREntry(v))
elif v['request']['url'] == sessionUrl:
- accessToken = json.loads(v["response"]["content"]["text"]).get("accessToken")
+ try:
+ accessToken = json.loads(v["response"]["content"]["text"]).get("accessToken")
+ except KeyError:
+ continue
cookies = {c['name']: c['value'] for c in v['request']['cookies']}
if not accessToken:
raise NoValidHarFileError("No accessToken found in .har files")
@@ -127,4 +130,4 @@ async def getArkoseAndAccessToken(proxy: str):
if chatArk is None:
return None, accessToken, cookies
newReq = genArkReq(chatArk)
- return await sendRequest(newReq, proxy), accessToken, cookies \ No newline at end of file
+ return await sendRequest(newReq, proxy), accessToken, cookies