diff options
Diffstat (limited to 'g4f/Provider')
-rw-r--r-- | g4f/Provider/openai/har_file.py | 7 |
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 |