当前位置:网站首页>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()
边栏推荐
- Print out all prime numbers between 1-100
- Training log 4 of the project "construction of Shandong University mobile Internet development technology teaching website"
- Strategic cooperation with many institutions shows the strength of the leading company of platofarm yuancosmos
- CMD window under Windows connects to MySQL and operates the table
- Training log 6 of the project "construction of Shandong University mobile Internet development technology teaching website"
- Intelligent security of the fifth space ⼤ real competition problem ----------- PNG diagram ⽚ converter
- Super simple integration HMS ml kit face detection to achieve cute stickers
- JDBC连接数据库详细步骤
- ReportingService WebService Form身份验证
- 新手入门:手把手从PHP环境到ThinkPHP6框架下载
猜你喜欢
C# 判断用户是手机访问还是电脑访问
运动健康深入人心,MOVE PROTOCOL引领品质生活
北京宝德&TaoCloud共建信创之路
Reporting Services- Web Service
How to make interesting apps for deep learning with zero code (suitable for novices)
裸金属云FASS高性能弹性块存储解决方案
Crypto巨头们ALL IN元宇宙,PlatoFarm或能突围
Xsan is highly available - xdfs and San are integrated with new vitality
农村品牌建设给年轻人的一些机会
Madonna "hellent" bought $1.3 million NFT boring ape, which is now considered too expensive
随机推荐
Thinkphp6 output QR code image format to solve the conflict with debug
剑指核心-TaoCloud全闪SDS助力构建高性能云服务
Dao race track is booming. What are the advantages of m-dao?
Laravel swagger add access password
“山东大学移动互联网开发技术教学网站建设”项目实训日志五
How can Plato obtain premium income through elephant swap in a bear market?
Print out all prime numbers between 1-100
xtrabackup 的使用
Simple optimization of interesting apps for deep learning (suitable for novices)
Sliding switch of tab of uniapp component
Xsan is highly available - xdfs and San are integrated with new vitality
IDEA使用JDBC连接MySQL数据库个人详细教程
主流实时流处理计算框架Flink初体验。
ssm整合
机器学习让文字识别更简单:Kotlin+MVVM+华为ML Kit
Bare metal cloud FASS high performance elastic block storage solution
全闪分布式,如何深度性能POC?
rsync+inotyfy实现数据单项监控实时同步
Laravel service container (inheritance and events)
Shanzhai coin Shib has a US $548.6 million stake in eth whale's portfolio - traders should be on guard