# 调用注册接口 ``` # -*- coding: utf-8 -*- # @Time : 2018/11/16 10:46 # @Author : sunjicheng #!/usr/bin/python3.8 import requests import json import datetime import random import redis import time #url = 'http://172.16.3.41:8041/chain/love/app/user/register' url='http://172.16.3.41/gateway.action' def generate_random_str(randomlength): """ 生成一个指定长度的随机字符串 """ random_str = '' base_str = '0123456789' base_str2='ABCDEFGHIGKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz0123456789' length = len(base_str) - 1 for i in range(randomlength): random_str += base_str[random.randint(0, length)] return random_str headers={ 'Accept': 'application/json;charset=UTF-8', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2', 'Cache-Control': 'max-age=0', 'Connection': 'keep-alive', 'Content-Type':'application/json', } s=generate_random_str(5000) #print(s) headers={ 'Content-Type':'application/json', } ''' init=111211 count=1112111 while count <= 1112116: count=count + 1 payload = {"stateNo": "86", "phone": "13610707306", "password": "123456", "repassword": "123456", "smsCode": "106147", "username": "sunsun" + str(count), "inviteCode": "sunsun" + str(init)} r = requests.post(url, headers=headers, data=json.dumps(payload)) print(payload) print(r.status_code) print(r.text) ''' ''' if count1 ==11316: break ''' print( random.randint(1,10) ) #userId 517801438209703936 #ent_id 1 phone1=13000000000 while phone1 <= 13000010000: phone1=phone1 + random.randint(1,10) print(phone1) r = redis.Redis(host='172.16.3.41', password='BH123!@#', port=6379, db=1) r.set(phone1, '\"123123\"', 600) #print(r.get(phone1)) t = int(round(time.time() * 1000)) #print(t) payload ={"appId": 1000000229591911, "timestamp": 1550224644490, "version": "1.1.0", "sign": "n8AoFF7AI3lgsDWHcogUs0L4vDBpwWcS4tf40py1pay85lixJZ4R98GA4K7FhT/BjnkV+VtbG7+p4J1hxvBOkMVgcoZfZgTzA/H05FaUozaqcqWWDWQ9mEzUGX87cNNlqF20LFt5Dzr6yokFmPSGLL8GIkwa8VkeVb+GtHRwguI=", "method": "bh.newretail.user.register", "content": {"inviterCode": "", "inviterPhone": "18511589153", "registerPhone":phone1, "verification": "123123", "password": "123456"}, "platform": "android", "greenChannel":"rgbWa}ji7tS7"} ''' payload = {"appId": "1000000229591911", "timestamp": t, "method": "bh.newretail.user.register","sign":"", "content": {"phone":phone1, "verification": "123123", "inviteCode": "ductnC"}, "version": "1.0","platform":"android", "greenChannel":"rgbWa}ji7tS7"} ''' r = requests.post(url, headers=headers, data=json.dumps(payload)) print(payload) print(r.status_code) print(r.text) ''' ''' ```