This commit is contained in:
Administrator
2025-11-11 10:07:38 +08:00
parent 97ec1b7c7e
commit 1e6e8b732b

View File

@@ -56,33 +56,50 @@ class WeexTransaction:
sign = base64.b64encode(hmac_code).decode('utf-8')
return sign
# def send_dingtalk_message(self, message_content):
# # 获取当前时间戳(毫秒)
# timestamp = str(round(time.time() * 1000))
# # 生成签名
# sign = self.get_signature(timestamp, )
# # 拼接带有签名信息的完整 Webhook URL
# full_url = f"{self.webhook_url}&timestamp={timestamp}&sign={sign}"
#
# # 定义消息内容
# message = {
# "msgtype": "text",
# "text": {
# "content": message_content
# }
# }
#
# # 设置请求头
# headers = {
# "Content-Type": "application/json"
# }
#
# try:
# # 发送 POST 请求
# response = requests.post(full_url, headers=headers, data=json.dumps(message))
#
# except requests.RequestException as e:
# print(f"请求发生错误: {e}")
def send_dingtalk_message(self, message_content):
# 获取当前时间戳(毫秒)
timestamp = str(round(time.time() * 1000))
# 生成签名
sign = self.get_signature(timestamp, )
# 拼接带有签名信息的完整 Webhook URL
full_url = f"{self.webhook_url}&timestamp={timestamp}&sign={sign}"
url = "http://8.137.99.82:9005/api/send_click?token=fegergauiernguie&phone=8613661496481"
res = requests.post(
url=url,
json={
"phone": "8613661496481",
"bot_name": "ergggreef",
"datas": [
{"send_message": [message_content], "click_button": [""], },
]
# 定义消息内容
message = {
"msgtype": "text",
"text": {
"content": message_content
}
}
)
# 设置请求头
headers = {
"Content-Type": "application/json"
}
try:
# 发送 POST 请求
response = requests.post(full_url, headers=headers, data=json.dumps(message))
except requests.RequestException as e:
print(f"请求发生错误: {e}")
print(res.json())
def openBrowser(self, ): # 直接指定ID打开窗口也可以使用 createBrowser 方法返回的ID
@@ -181,14 +198,14 @@ class WeexTransaction:
time.sleep(1)
html_text = self.remove_tags_and_spaces(html=self.mn_tab.html)
# 定义正则表达式模式,用于匹配包含逗号和小数点的数值
pattern = r'委托可用([\d,]+)\.\d+SUSDT'
pattern = r'委托可用([\d,]+\.\d+)SUSDT'
# 使用 re.search 方法查找匹配项
match = re.search(pattern, html_text)
number = ""
if match:
# 提取匹配到的数值字符串
number_str = match.group().replace(',', '')
number_str = match.group(1).replace(',', '')
# 将提取的字符串转换为浮点数
number = float(number_str)