https://blog.csdn.net/Json_Steve/article/details/102823982
#计算钉钉加密 def DingDingWebhook(access_token,secret): import time,hmac,hashlib,base64,urllib.parse # 此处填写你的DingDing token access_token = access_token # 此处填写你的钉钉加签秘钥 secret = secret timestamp = "%d" % (time.time() * 1000) sign = timestamp+'\n'+secret j = hmac.new(secret.encode(), msg=sign.encode(), digestmod=hashlib.sha256) sign = urllib.parse.quote(base64.b64encode(j.digest()), safe='') webhook='https://oapi.dingtalk.com/robot/send?access_token={}×tamp={}&sign={}'.format(access_token,timestamp,sign) return webhook