mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-11-22 15:05:57 +03:00
Don't give up searching for accessToken in HAR file
This commit is contained in:
parent
766b323572
commit
8c7292035e
@ -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
|
||||
return await sendRequest(newReq, proxy), accessToken, cookies
|
||||
|
Loading…
Reference in New Issue
Block a user