``APPID = 'xxxxxxxxx'
APPSECRET = 'xxxxxxxxxxxxxx'
response = requests.get(
'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={}&secret={}'.format(APPID, APPSECRET)
)
ACCESS_TOKEN = response.json()
DD = ACCESS_TOKEN.get('access_token')
result = requests.post(url=r'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={}'.format(DD), headers = {'Content-Type': 'application/json','User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36'}, data=
json.dumps({
"touser": "需要发送的用户的openid",
"template_id": "消息模板id",
"url": "https://weixin.qq.com/download",