Completed
Pull Request — master (#554)
by
unknown
03:07
created

getappinfo()   A

Complexity

Conditions 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 3
c 2
b 1
f 0
dl 0
loc 10
rs 9.4285
1
from lib.wechatutil.wechatapp import WechatApplication
2
apiUrl = 'https://qyapi.weixin.qq.com/cgi-bin/agent/get'
3
4
5
def getappinfo(id, factory):
0 ignored issues
show
Bug Best Practice introduced by
This seems to re-define the built-in id.

It is generally discouraged to redefine built-ins as this makes code very hard to read.

Loading history...
6
    payload = {"agentid": id}
7
    response = factory.get(apiUrl, payload)
8
    if response['errcode'] != '0':
9
        factory.refreshtoken()
10
        response = factory.get(apiUrl, payload)
11
    if response['errcode'] == '0':
12
        return 0, WechatApplication(response), None
0 ignored issues
show
Bug introduced by
There seem to be too many positional arguments for this constructor call.
Loading history...
13
    else:
14
        return int(response['errcode']), None, response['errmsg']
15