self_example/Spider/Chapter10_模拟登录/大规模账号池的搭建/AccountPool/register.py

31 lines
873 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import argparse
from acinonyx import run
import requests
from loguru import logger
# 具体用法参考https://pypi.org/project/acinonyx/
# This is a script for registering account for antispider7, using acinonyx to accelerate.
parser = argparse.ArgumentParser(description='AccountPool')
parser.add_argument('website', type=str, help='website')
args = parser.parse_args()
website = args.website
@logger.catch()
def register(username, password):
logger.debug(f'register using {username} and {password}')
response = requests.post(f'https://{website}.scrape.center/api/register', json={
'username': username,
'password': password
})
print(response.json())
if __name__ == '__main__':
accounts = []
# 注册
for index in range(1, 1000):
accounts.append((f'admin{index}', f'admin{index}'))
run(register, accounts)