| Conditions | 2 | 
| Total Lines | 8 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | apiUrl = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken'  | 
            ||
| 4 | def gettoken(corpid, secret, session):  | 
            ||
| 5 |     header = {'content-type': 'application/json; charset=utf8'} | 
            ||
| 6 |     payload = {"corpid": corpid, "corpsecret": secret} | 
            ||
| 7 | response = session.get(apiUrl, params=payload, headers=header).json()  | 
            ||
| 8 | if response['access_token'] is not None:  | 
            ||
| 9 | return 0, response['access_token'], None  | 
            ||
| 10 | else:  | 
            ||
| 11 | return response['errcode'], None, response['errmsg']  | 
            ||
| 
                                                                                                    
                        
                         |