1、使用场景:一个发送短信的函数,一个登陆的函数,登陆函数需要调用发送短信
def send_message(ip):
"""1、发送短信"""
url = "http://" + ip + ".123.com/api/sms/send"
print(url)
params = {
"mobile": "188****",
"type": "1"}
headers = {'content-type': 'application/json'}
ret = requests.post(url, data=json.dumps(params), headers=headers)
ret_json = json.loads(ret.text)
def login(ip="exp", account="188***"):
"""2、点击登陆"""
send_message(ip)
time.sleep(3)
url = "http://" + ip + ".123.com/api/user/login"
print(url)
# url_login = "http://dev.123.com/api/user/login"
params = {
"account": account,
"code": "123456"}
headers = {'content-type': 'application/jso