Spaces:
Paused
Paused
Upload register_bot.py
Browse files- register_bot.py +12 -3
register_bot.py
CHANGED
|
@@ -45,8 +45,17 @@ RETRY_DELAY = 10 # 秒
|
|
| 45 |
RATE_LIMIT_DELAY = 60 # 秒
|
| 46 |
|
| 47 |
def generate_strong_password():
|
| 48 |
-
"""
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
def generate_code_verifier():
|
| 52 |
return base64.urlsafe_b64encode(uuid.uuid4().bytes).decode('utf-8').rstrip('=')
|
|
@@ -274,7 +283,7 @@ def register_and_verify(num_accounts=1):
|
|
| 274 |
|
| 275 |
def process_account(email):
|
| 276 |
try:
|
| 277 |
-
#
|
| 278 |
password = generate_strong_password()
|
| 279 |
|
| 280 |
if register(email, password):
|
|
|
|
| 45 |
RATE_LIMIT_DELAY = 60 # 秒
|
| 46 |
|
| 47 |
def generate_strong_password():
|
| 48 |
+
"""
|
| 49 |
+
从环境变量获取密码,如果未设置则抛出异常
|
| 50 |
+
"""
|
| 51 |
+
# 尝试从环境变量获取密码
|
| 52 |
+
env_password = os.getenv('REGISTER_PASSWORD')
|
| 53 |
+
|
| 54 |
+
if not env_password:
|
| 55 |
+
logging.error("未设置 REGISTER_PASSWORD 环境变量")
|
| 56 |
+
raise ValueError("必须通过 REGISTER_PASSWORD 环境变量指定密码")
|
| 57 |
+
|
| 58 |
+
return env_password
|
| 59 |
|
| 60 |
def generate_code_verifier():
|
| 61 |
return base64.urlsafe_b64encode(uuid.uuid4().bytes).decode('utf-8').rstrip('=')
|
|
|
|
| 283 |
|
| 284 |
def process_account(email):
|
| 285 |
try:
|
| 286 |
+
# 使用环境变量获取密码
|
| 287 |
password = generate_strong_password()
|
| 288 |
|
| 289 |
if register(email, password):
|