说明:
1、表头进行合并单元格,并调小表头字体
2、设置表格边框颜色、大小
3、设置标题、单元格、表头字体、颜色大小
#! /usr/bin/python3
# -*- coding: utf-8 -*-
import imgkit
from HTMLTable import HTMLTable
import requests
import hashlib
import base64
import json
def send_image(key, image):
wx_url = f"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={key}"
with open(image, 'rb') as fp:
# 获取base64位数据
data = fp.read()
get_base64 = base64.b64encode(data)
base64_data = str(get_base64, 'utf-8')
# 获取md5值
md = hashlib.md5()
md.update(data)
image_md5 = md.hexdigest()
headers = {
"Content-Type": "application/json",
}
body = {
"msgtype": "image",
"image": {
"base64": base64_data,
"md5": image_md5
}
}
req = requests.post(url=wx_url, data=json