当前位置:网站首页>Nailing alarm script
Nailing alarm script
2022-07-29 05:55:00 【JACK-JIE】
# -*- coding: utf-8 -*-
import time
import hmac
import hashlib
import base64
import urllib.parse
import requests
import json
import sys
import os
from email.mime.text import MIMEText
from email.header import Header
class dd:
def __init__(self, secret, url,atmobiles, mes):
self.timestamp = str(round(time.time() * 1000))
self.secret = secret
self.secret_enc = self.secret.encode('utf-8')
self.string_to_sign = '{}\n{}'.format(self.timestamp, self.secret)
self.string_to_sign_enc = self.string_to_sign.encode('utf-8')
self.hmac_code = hmac.new(self.secret_enc, self.string_to_sign_enc, digestmod=hashlib.sha256).digest()
self.sign = urllib.parse.quote_plus(base64.b64encode(self.hmac_code))
self.url = url
self.atmobiles = atmobiles
self.mes = mes
def req(self):
# Take what you got in the second step timestamp and sign Joining together to URL in
url = f'{self.url}'f'×tamp={self.timestamp}'f'&sign={self.sign}'
h = {'content-type': 'application/json', 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0'}
#d Inside at Parameter is required at Human parameters of , Only at Only when people exist in this parameter @ success
d = json.dumps({"msgtype": "text", "text": {"content": self.mes}, "at": {"atMobiles": self.atmobiles, "isAtAll": "false"}})
req = requests.post(url, data=d, headers=h)
print(req.text)
if __name__ == '__main__':
secret = '*************************90c8a5df55ba4b91f6451a7d' # What is filled in here is the endorsement obtained above **
url = 'https://oapi.dingtalk.com/robot/send?access_token=**********************************d138a8d6da841edaf34200b9f9710'
atmobiles = ["138xxxx0751","157xxxx1995"]
mes = ' Hello , Brother tree !'
dd = dd(secret, url, atmobiles, mes)
dd.req()边栏推荐
猜你喜欢

Performance comparison | FASS iSCSI vs nvme/tcp

重庆大道云行作为软件产业代表受邀参加渝中区重点项目签约仪式

手撕ORM 框架(泛型+注解+反射)

Markdown语法

Sliding switch of tab of uniapp component

北京宝德&TaoCloud共建信创之路

Move protocol global health declaration, carry out the health campaign to the end

Power BI Report Server 自定义身份验证

完全去中心化的编程模式,不需要服务器,也不需要ip,就像一张漫无目的的网络、四处延伸

Super simple integration of HMS ml kit to realize parent control
随机推荐
Get the number of daffodils
Laravel service container (Application of context binding)
rsync+inotyfy实现数据单项监控实时同步
My ideal job, the absolute freedom of coder farmers is the most important - the pursuit of entrepreneurship in the future
Starfish OS: create a new paradigm of the meta universe with reality as the link
“山东大学移动互联网开发技术教学网站建设”项目实训日志四
Novice introduction: download from PHP environment to thinkphp6 framework by hand
Training log 6 of the project "construction of Shandong University mobile Internet development technology teaching website"
数组的基础使用--遍历循环数组求出数组最大值,最小值以及最大值下标,最小值下标
xtrabackup 的使用
Intelligent security of the fifth space ⼤ real competition problem ----------- PNG diagram ⽚ converter
Crypto giants all in metauniverse, and platofarm may break through
File文件上传的使用(2)--上传到阿里云Oss文件服务器
Fantom (FTM) 在 FOMC会议之前飙升 45%
MySql统计函数COUNT详解
熊市下PLATO如何通过Elephant Swap,获得溢价收益?
Training log 7 of the project "construction of Shandong University mobile Internet development technology teaching website"
CMD window under Windows connects to MySQL and operates the table
山寨币SHIB 在 ETH 鲸鱼的投资组合中拥有 5.486 亿美元的股份——交易者应提防……
30 knowledge points that must be mastered in quantitative development [what is individual data]?