data参数API
headers参数配置
import hashlib
import time
import uuid
import requests
if __name__ == '__main__':
sms_url = 'https://api.netease.im/sms/sendcode.action'
post_data = {
'mobile':'13383338888'
}
cur_time = str(time.time())
app_secret = 'b836167f3f0'
nonce = str(uuid.uuid4())
# 参数拼接
before = app_secret + nonce + cur_time
# 哈希加密
check_sum = hashlib.new('sha1',before.encode('utf-8')).hexdigest()
headers = {
'AppKey':'5339f046d3cce96c0e427c699740ecc0',
'Nonce':nonce,
'CurTime':cur_time,
'CheckSum':check_sum
}
response = requests.post(sms_url,data=post_data,headers=headers)
print(response.json())
结果
返回结果.png
网友评论