import requests import base64 import random import string
url = 'http://52.149.144.45:8080'
# s = requests.session() # r = s.post(url+'/user/login', data={ # 'username': 'dubhe0', # 'password': '123456' # })
base = base64.b64decode('QBCHVevOmPI1JBUuV974yHwOmh3xhny6be3KVXeMyqT2dMpO9XtCH104apBGgEca5AhJkEmBj7dlu3qesOoBHNCGotSmPRMlxn8OXEFuca4G0lM/80Iq7s1qM0eZT2/lDudyuXsa34qAZZjh8EApuMmVQNhyaLlSm0mJce6DJtE=')
for i inrange(10000): username = 'dubhe' + ''.join(random.choices(string.ascii_uppercase + string.digits, k=6)) r = requests.post(url+'/user/register', data={ 'username': username, 'password': '123456' }) r = requests.post(url+'/user/login', data={ 'username': username, 'password': '123456' }) api_token = r.json()['user']['api_token'] r = requests.post(url+'/lottery/buy', data={ 'api_token': api_token }) lottery = base64.b64decode(r.json()['enc']) fake_lottery = lottery[:64] + base[32:] r = requests.post(url+'/lottery/charge', data={ 'user': '2877b56d-0a0c-493e-9e4e-52c5f30dcbff', 'coin': '100', 'enc': base64.b64encode(fake_lottery) }) print(r.json())