python 網易雲信API傳送簡訊

2021-10-08 20:14:55 字數 1064 閱讀 7944

# coding=utf-8

import hashlib

import time

import requests

defsend_code

(mobile)

: url =

''""" nonce 隨機數(最大長度128個字元)

curtime 當前utc時間戳,從2023年1月1日0點0 分0 秒開始到現在的秒數(string)

""""***************"

# 生成128個長度以內的隨機字串

nonce = hashlib.new(

'sha512'

,str

(time.time())

.encode(

"utf-8"))

.hexdigest(

)# 獲取當前時間戳

curtime =

str(

int(time.time())

) serct =

"**************"

# 根據要求進行sha1雜湊計算

check_sum = hashlib.sha1(

(serct + nonce + curtime)

.encode(

"utf-8"))

.hexdigest(

)print

(nonce,

"\n"

,len

(nonce)

)print

(curtime)

print

(check_sum)

header =

data =

resp = requests.post(url,data=data,headers=header)

print

("response:"

,resp.content)

if __name__ ==

'__main__'

: send_code(

"接受簡訊的手機號"

)

python 網易 python傳送網易郵件

無附件 from smtplib import smtp from email.header import header from email.mime.text import mimetext def main sender 1355 25 163.com receivers 1047 32 qq...

雲信api 雲信SDK示例

網易雲信server api 介面使用示例 1.6 author hzchensheng15 corp.netease.com date 2015 10 28 10 30 使用示例 require serverapi.php 建立雲信id print r p createuserid sulayma...

雲信api 雲信SDK示例

網易雲信server api 介面使用示例 1.6 author hzchensheng15 corp.netease.com date 2015 10 28 10 30 使用示例 require serverapi.php 建立雲信id print r p createuserid sulayma...