Completed
Pull Request — master (#527)
by
unknown
05:06
created

getappinfo()   A

Complexity

Conditions 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
c 1
b 0
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
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...
5
    payload = {"agentid": id}
6
    response = factory.get(apiUrl, payload)
7
    if response['errcode'] != '0':
8
        factory.refreshtoken();
0 ignored issues
show
Coding Style introduced by
Unnecessary semicolon
Loading history...
9
        response = factory.get(apiUrl, payload)
10
    if response['errcode'] == '0':
11
        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...
12
    else:
13
        return int(response['errcode']), None, response['errmsg']
14
15