zabbix–python短信接口脚本

释放双眼,带上耳机,听听看~!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
1#!/usr/bin/env python  
2#-*- coding: utf8 -*-
3
4import sys  
5import requests  
6import json
7
8def sendsms(phone, subject, message):  
9    """  
10    发送短信  
11    """  
12    values = {"appCode": "ZBXSZ",  
13        "businessType": "tz",  
14        "businessNo": "adf324",  
15        "phoneNums": phone,  
16        "templCode": "bqjrtzZBXSZyzryy73760",  
17        "atTime": "null",  
18        "paramsBody": {  
19            "value0": subject,  
20            "value1": message  
21        }  
22    }  
23    headers = {'Content-Type': 'application/json'}
24
25
26    host = 'aps.bqjr.cn'
27    post_url = 'http://' + host + '/bqjr/msg/send'
28    response = requests.post(url=post_url, headers=headers, data=json.dumps(values))
29    try:
30        req= requests.post(url=post_url, data=json.dumps(values))
31        print req.content
32    except Exception, e:
33        print e
34
35    
36
37if name == '__main__':  
38    phone = sys.argv[1]  
39    subject = sys.argv[2]  
40    message = sys.argv[3]  
41    sendsms(phone, subject, message)
42    
43

给TA打赏
共{{data.count}}人
人已打赏
安全技术

C++迭代器

2022-1-11 12:36:11

安全技术

JavaScript继承

2022-1-12 12:36:11

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索