summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/openai/proofofwork.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-11-18 05:13:15 +0100
committerGitHub <noreply@github.com>2024-11-18 05:13:15 +0100
commit6cccd6d9ac106b7df80fd263e97a921974f0504a (patch)
treeb9e8bf7c11c1a4f0ff517faf54f471dcbe2d8f8f /g4f/Provider/openai/proofofwork.py
parentDelete .github/workflows/auto-pr-description.yml (diff)
parentAdd full nodriver support to OpenaiChat (diff)
downloadgpt4free-6cccd6d9ac106b7df80fd263e97a921974f0504a.tar
gpt4free-6cccd6d9ac106b7df80fd263e97a921974f0504a.tar.gz
gpt4free-6cccd6d9ac106b7df80fd263e97a921974f0504a.tar.bz2
gpt4free-6cccd6d9ac106b7df80fd263e97a921974f0504a.tar.lz
gpt4free-6cccd6d9ac106b7df80fd263e97a921974f0504a.tar.xz
gpt4free-6cccd6d9ac106b7df80fd263e97a921974f0504a.tar.zst
gpt4free-6cccd6d9ac106b7df80fd263e97a921974f0504a.zip
Diffstat (limited to 'g4f/Provider/openai/proofofwork.py')
-rw-r--r--g4f/Provider/openai/proofofwork.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/g4f/Provider/openai/proofofwork.py b/g4f/Provider/openai/proofofwork.py
index 23e5ab6e..4294c99a 100644
--- a/g4f/Provider/openai/proofofwork.py
+++ b/g4f/Provider/openai/proofofwork.py
@@ -4,16 +4,16 @@ import json
import base64
from datetime import datetime, timezone
-def generate_proof_token(required: bool, seed: str = "", difficulty: str = "", user_agent: str = None, proofToken: str = None):
+def generate_proof_token(required: bool, seed: str = "", difficulty: str = "", user_agent: str = None, proof_token: str = None):
if not required:
return
- if proofToken is None:
+ if proof_token is None:
screen = random.choice([3008, 4010, 6000]) * random.choice([1, 2, 4])
# Get current UTC time
now_utc = datetime.now(timezone.utc)
parse_time = now_utc.strftime('%a, %d %b %Y %H:%M:%S GMT')
- proofToken = [
+ proof_token = [
screen, parse_time,
None, 0, user_agent,
"https://tcr9i.chat.openai.com/v2/35536E1E-65B4-4D96-9D97-6ADB7EFF8147/api.js",
@@ -26,8 +26,8 @@ def generate_proof_token(required: bool, seed: str = "", difficulty: str = "", u
diff_len = len(difficulty)
for i in range(100000):
- proofToken[3] = i
- json_data = json.dumps(proofToken)
+ proof_token[3] = i
+ json_data = json.dumps(proof_token)
base = base64.b64encode(json_data.encode()).decode()
hash_value = hashlib.sha3_512((seed + base).encode()).digest()