def grant_access_token(self):
        """
        获取 access token 并更新当前配置
        :return: 返回的 JSON 数据包 (传入 access_token_refreshfunc 参数后返回 None)
        """
        self._check_appid_appsecret()

        if callable(self.__access_token_refreshfunc):
            self.__access_token, self.__access_token_expires_at = self.__access_token_refreshfunc()
            return

        response_json = self.__request.get(
            url="https://api.weixin.qq.com/cgi-bin/token",
            params={
                "grant_type": "client_credential",
                "appid": self.__appid,
                "secret": self.__appsecret,
            },
            access_token=self.__access_token
        )
        self.__access_token = response_json['access_token']
        self.__access_token_expires_at = int(time.time()) + response_json['expires_in']

        if callable(self.__access_token_setfunc):
            self.__access_token_setfunc(self.__access_token, self.__access_token_expires_at)

        return response_json
def grant_access_token(self):
        """
        获取 access token 并更新当前配置
        :return: 返回的 JSON 数据包 (传入 access_token_refreshfunc 参数后返回 None)
        """
        self._check_appid_appsecret()

        if callable(self.__access_token_refreshfunc):
            self.__access_token, self.__access_token_expires_at = self.__access_token_refreshfunc()
            return

        response_json = self.__request.get(
            url="https://api.weixin.qq.com/cgi-bin/token",
            params={
                "grant_type": "client_credential",
                "appid": self.__appid,
                "secret": self.__appsecret,
            },
            access_token=self.__access_token
        )
        self.__access_token = response_json['access_token']
        self.__access_token_expires_at = int(time.time()) + response_json['expires_in']

        if callable(self.__access_token_setfunc):
            self.__access_token_setfunc(self.__access_token, self.__access_token_expires_at)

        return response_json
def grant_access_token ( self ) : self . _check_appid_appsecret ( ) if callable ( self . __access_token_refreshfunc ) : self . __access_token , self . __access_token_expires_at = self . __access_token_refreshfunc ( ) return response_json = self . __request . get ( url = "https://api.weixin.qq.com/cgi-bin/token" , params = { "grant_type" : "client_credential" , "appid" : self . __appid , "secret" : self . __appsecret , } , access_token = self . __access_token ) self . __access_token = response_json [ 'access_token' ] self . __access_token_expires_at = int ( time . time ( ) ) + response_json [ 'expires_in' ] if callable ( self . __access_token_setfunc ) : self . __access_token_setfunc ( self . __access_token , self . __access_token_expires_at ) return response_json
获取 access token 并更新当前配置
        :return: 返回的 JSON 数据包 (传入 access_token_refreshfunc 参数后返回 None)
获取 access token 并更新当前配置 : return : 返回的 JSON 数据包 ( 传入 access_token_refreshfunc 参数后返回 None )