Skip to content

Commit

Permalink
Update login_script.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tianzhentech authored Sep 18, 2024
1 parent 3524e19 commit ea19738
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions login_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ async def login(username, password, panel):
if page:
await page.close()

async def process_account(account):
username = account['username']
password = account['password']
panel = account['panel']

await login(username, password, panel)

delay = random.randint(1000, 8000)
await delay_time(delay)

async def main():
global success_count, fail_count, failed_usernames
success_count = 0
Expand All @@ -93,15 +103,8 @@ async def main():
print(f'读取 accounts.json 文件时出错: {e}')
return

for account in accounts:
username = account['username']
password = account['password']
panel = account['panel']

await login(username, password, panel)

delay = random.randint(1000, 8000)
await delay_time(delay)
# 使用 asyncio.gather 并发处理所有账号
await asyncio.gather(*(process_account(account) for account in accounts))

# 计算总耗时
end_time = datetime.now()
Expand Down

0 comments on commit ea19738

Please sign in to comment.