Completed
Pull Request — master (#554)
by
unknown
02:41
created

send_msg()   A

Complexity

Conditions 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
1
import json
2
apiUrl = 'https://qyapi.weixin.qq.com/cgi-bin/message/send'
3
4
5
def send_msg(message, factory):
6
    response = factory.post(apiUrl, data=json.dumps(message.args))
7
    if response['errcode'] != 0:
8
        factory.refreshtoken()
9
        response = factory.post(apiUrl, data=json.dumps(message.args))
10
    return response['errcode'], response['errmsg']
11