diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-04-09 18:18:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-09 18:18:58 +0200 |
commit | af0369320470ba21e6c26c28a446272e87c1f0fc (patch) | |
tree | 45470479cff8f8b41162ef455a66bd477d3d6f30 /g4f/Provider | |
parent | Update unittest.yml (diff) | |
parent | Don't give up searching for accessToken in HAR file (diff) | |
download | gpt4free-af0369320470ba21e6c26c28a446272e87c1f0fc.tar gpt4free-af0369320470ba21e6c26c28a446272e87c1f0fc.tar.gz gpt4free-af0369320470ba21e6c26c28a446272e87c1f0fc.tar.bz2 gpt4free-af0369320470ba21e6c26c28a446272e87c1f0fc.tar.lz gpt4free-af0369320470ba21e6c26c28a446272e87c1f0fc.tar.xz gpt4free-af0369320470ba21e6c26c28a446272e87c1f0fc.tar.zst gpt4free-af0369320470ba21e6c26c28a446272e87c1f0fc.zip |
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 |