当前位置:网站首页>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()
边栏推荐
- 我的理想工作,码农的绝对自由支配才是最重要的——未来创业的追求
- 农村品牌建设给年轻人的一些机会
- Mobile terminal -flex item attribute
- Idea using JDBC to connect mysql database personal detailed tutorial
- xSAN高可用—XDFS与SAN融合焕发新生命力
- Refresh, swagger UI theme changes
- Windows下cmd窗口连接mysql并操作表
- Training log III of "Shandong University mobile Internet development technology teaching website construction" project
- 赓续新征程,共驭智存储
- Read and understand move2earn project - move
猜你喜欢
Changed crying, and finally solved cannot read properties of undefined (reading 'parsecomponent')
How to PR an open source composer project
Sliding switch of tab of uniapp component
Reporting Services- Web Service
Simple optimization of interesting apps for deep learning (suitable for novices)
Training log 4 of the project "construction of Shandong University mobile Internet development technology teaching website"
Okaleido Tiger 7.27日登录Binance NFT,首轮已获不俗成绩
Performance comparison | FASS iSCSI vs nvme/tcp
识变!应变!求变!
“山东大学移动互联网开发技术教学网站建设”项目实训日志二
随机推荐
剑指核心-TaoCloud全闪SDS助力构建高性能云服务
How to PR an open source composer project
Training log III of "Shandong University mobile Internet development technology teaching website construction" project
Simple optimization of interesting apps for deep learning (suitable for novices)
Crypto巨头们ALL IN元宇宙,PlatoFarm或能突围
MOVE PROTOCOL全球健康宣言,将健康运动进行到底
DeFi 2.0的LaaS协议,重振DeFi赛道发展的关键
iSCSI vs iSER vs NVMe-TCP vs NVMe-RDMA
Gluster cluster management analysis
DAO赛道异军突起,M-DAO的优势在哪里?
Use of file upload (2) -- upload to Alibaba cloud OSS file server
与张小姐的春夏秋冬(2)
Sliding switch of tab of uniapp component
数组的基础使用--遍历循环数组求出数组最大值,最小值以及最大值下标,最小值下标
Crypto giants all in metauniverse, and platofarm may break through
超简单集成HMS ML Kit 人脸检测实现可爱贴纸
Move protocol global health declaration, carry out the health campaign to the end
Reporting Services- Web Service
山寨币SHIB 在 ETH 鲸鱼的投资组合中拥有 5.486 亿美元的股份——交易者应提防……
Fantom (FTM) 在 FOMC会议之前飙升 45%