some more logging

This commit is contained in:
abc 2024-04-15 10:31:36 +01:00
parent e5a57646db
commit fdbb474151
3 changed files with 9 additions and 0 deletions

1
.gitignore vendored
View File

@ -63,3 +63,4 @@ dist.py
x.txt x.txt
bench.py bench.py
to-reverse.txt to-reverse.txt
g4f/Provider/OpenaiChat2.py

View File

@ -371,6 +371,8 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin):
except NoValidHarFileError: except NoValidHarFileError:
... ...
if cls._api_key is None: if cls._api_key is None:
if debug.logging:
print("Getting access token with nodriver.")
await cls.nodriver_access_token() await cls.nodriver_access_token()
cls.default_model = cls.get_model(await cls.get_default_model(session, cls._headers)) cls.default_model = cls.get_model(await cls.get_default_model(session, cls._headers))
@ -387,6 +389,9 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin):
need_arkose = data["arkose"]["required"] need_arkose = data["arkose"]["required"]
chat_token = data["token"] chat_token = data["token"]
if debug.logging:
print(f'Arkose: {need_arkose} Turnstile: {data["turnstile"]["required"]}')
if need_arkose and arkose_token is None: if need_arkose and arkose_token is None:
arkose_token, api_key, cookies = await getArkoseAndAccessToken(proxy) arkose_token, api_key, cookies = await getArkoseAndAccessToken(proxy)
cls._create_request_args(cookies) cls._create_request_args(cookies)

View File

@ -149,4 +149,7 @@ async def telemetry_id_with_driver(proxy: str = None):
response = requests.post('https://telemetry.stytch.com/submit', response = requests.post('https://telemetry.stytch.com/submit',
headers=headers, data=payload, proxies=proxies) headers=headers, data=payload, proxies=proxies)
if '-' in response.text:
print(f'telemetry generated: {response.text}')
return (response.text) return (response.text)