当前位置: 首页>>代码示例>>Python>>正文


Python logger.debug函数代码示例

本文整理汇总了Python中smart_qq_bot.logger.logger.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: uin_to_account

    def uin_to_account(self, tuin):
        """
        将uin转换成用户QQ号
        :param tuin:
        :return:str 用户QQ号
        """
        uin_str = str(tuin)
        try:
            logger.info("RUNTIMELOG Requesting the account by uin:    " + str(tuin))
            info = json.loads(
                self.client.get(
                    'http://s.web2.qq.com/api/get_friend_uin2?tuin={0}&type=1&vfwebqq={1}&t={2}'.format(
                        uin_str,
                        self.vfwebqq,
                        self.client.get_timestamp()
                    ),
                    SMART_QQ_REFER
                )
            )
            logger.debug("RESPONSE uin_to_account html:    " + str(info))
            if info['retcode'] != 0:
                raise TypeError('uin_to_account retcode error')
            info = info['result']['account']
            return info

        except Exception:
            logger.exception("RUNTIMELOG uin_to_account fail")
            return None
开发者ID:Akizukii,项目名称:SmartQQBot,代码行数:28,代码来源:bot.py

示例2: get_self_info

    def get_self_info(self):
        """
        获取自己的信息, 并存入self._self_info
        get_self_info2
        {"retcode":0,"result":{"birthday":{"month":1,"year":1989,"day":30},"face":555,"phone":"","occupation":"","allow":1,"college":"","uin":2609717081,"blood":0,"constel":1,"lnick":"","vfwebqq":"68b5ff5e862ac589de4fc69ee58f3a5a9709180367cba3122a7d5194cfd43781ada3ac814868b474","homepage":"","vip_info":0,"city":"青岛","country":"中国","personal":"","shengxiao":5,"nick":"要有光","email":"","province":"山东","account":2609717081,"gender":"male","mobile":""}}
        :return:dict
        """
        try_times = 0

        while len(self._self_info) is 0:
            url = "http://s.web2.qq.com/api/get_self_info2?t={}".format(time.time())
            response = self.client.get(url)
            logger.debug("get_self_info2 response:{}".format(response))
            rsp_json = json.loads(response)
            if rsp_json["retcode"] != 0:
                try_times += 1
                logger.warning("get_self_info2 fail. {}".format(try_times))
                if try_times >= 5:
                    return {}
            try:
                self._self_info = rsp_json["result"]
            except KeyError:
                logger.warning("get_self_info2 failed. Retrying.")
                continue
        return self._self_info
开发者ID:Akizukii,项目名称:SmartQQBot,代码行数:25,代码来源:bot.py

示例3: get_friend_info2

    def get_friend_info2(self, tuin):
        """
        获取好友详情信息
        get_friend_info2
        {"retcode":0,"result":{"face":0,"birthday":{"month":1,"year":1989,"day":30},"occupation":"","phone":"","allow":1,"college":"","uin":3964575484,"constel":1,"blood":3,"homepage":"http://blog.lovewinne.com","stat":20,"vip_info":0,"country":"中国","city":"","personal":"","nick":" 信","shengxiao":5,"email":"[email protected]","province":"山东","gender":"male","mobile":"158********"}}
        :return:dict
        """
        uin_str = str(tuin)
        try:
            logger.info("RUNTIMELOG Requesting the account info by uin:    " + str(tuin))
            info = json.loads(self.client.get(
                    'http://s.web2.qq.com/api/get_friend_info2?tuin={0}&vfwebqq={1}&clientid={2}&psessionid={3}&t={4}'
                        .format(
                            uin_str,
                            self.vfwebqq,
                            self.client_id,
                            self.psessionid,
                            self.client.get_timestamp()),
            ))
            logger.debug("RESPONSE get_friend_info2 html:    " + str(info))
            if info['retcode'] != 0:
                raise TypeError('get_friend_info2 result error')
            info = info['result']
            return info

        except:
            logger.warning("RUNTIMELOG get_friend_info2 fail")
            return None
开发者ID:crab890715,项目名称:SmartQQBot,代码行数:28,代码来源:bot.py

示例4: get_friend_info

    def get_friend_info(self, tuin):
        """
        获取好友详情信息
        get_friend_info
        {"retcode":0,"result":{"face":0,"birthday":{"month":1,"year":1989,"day":30},"occupation":"","phone":"","allow":1,"college":"","uin":3964575484,"constel":1,"blood":3,"homepage":"http://blog.lovewinne.com","stat":20,"vip_info":0,"country":"中国","city":"","personal":"","nick":" 信","shengxiao":5,"email":"[email protected]","province":"山东","gender":"male","mobile":"158********"}}
        :return:dict
        """

        uin = str(tuin)
        if uin not in self.friend_uin_list:
            logger.info("RUNTIMELOG Requesting the account info by uin: {}".format(uin))
            info = json.loads(self.client.get(
                'http://s.web2.qq.com/api/get_friend_info2?tuin={0}&vfwebqq={1}&clientid={2}&psessionid={3}&t={4}'.format(
                    uin,
                    self.vfwebqq,
                    self.client_id,
                    self.psessionid,
                    self.client.get_timestamp()
                )
            ))
            logger.debug("get_friend_info2 html: {}".format(str(info)))
            if info['retcode'] != 0:
                logger.warning('get_friend_info2 retcode unknown: {}'.format(info))
                return None
            info = info['result']
            info['account'] = self.uin_to_account(uin)
            info['longnick'] = self.get_friend_longnick(uin)
            self.friend_uin_list[uin] = info

        try:
            return self.friend_uin_list[uin]
        except:
            logger.warning("RUNTIMELOG get_friend_info return fail.")
            logger.debug("RUNTIMELOG now uin list:    " + str(self.friend_uin_list[uin]))
开发者ID:Akizukii,项目名称:SmartQQBot,代码行数:34,代码来源:bot.py

示例5: get_online_friends_list

    def get_online_friends_list(self):
        """
        获取在线好友列表
        get_online_buddies2
        :return:list
        """
        logger.info("RUNTIMELOG Requesting the online buddies.")
        response = self.client.get(
            'http://d1.web2.qq.com/channel/get_online_buddies2?vfwebqq={0}&clientid={1}&psessionid={2}&t={3}'.format(
                self.vfwebqq,
                self.client_id,
                self.psessionid,
                self.client.get_timestamp(),
            )
        )  # {"result":[],"retcode":0}
        logger.debug("RESPONSE get_online_buddies2 html:{}".format(response))
        try:
            online_buddies = json.loads(response)
        except ValueError:
            logger.warning("get_online_buddies2 response decode as json fail.")
            return None

        if online_buddies['retcode'] != 0:
            logger.warning('get_online_buddies2 retcode is not 0. returning.')
            return None

        online_buddies = online_buddies['result']
        return online_buddies
开发者ID:Akizukii,项目名称:SmartQQBot,代码行数:28,代码来源:bot.py

示例6: get_group_member_info_list

 def get_group_member_info_list(self, group_code):
     """
     获取指定群的成员信息
     :group_code: int, can be "ture" of "fake" group_code
     {"retcode":0,"result":{"stats":[],"minfo":[{"nick":" 信","province":"山东","gender":"male","uin":3964575484,"country":"中国","city":""},{"nick":"崔震","province":"","gender":"unknown","uin":2081397472,"country":"","city":""},{"nick":"云端的猫","province":"山东","gender":"male","uin":3123065696,"country":"中国","city":"青岛"},{"nick":"要有光","province":"山东","gender":"male","uin":2609717081,"country":"中国","city":"青岛"},{"nick":"小莎机器人","province":"广东","gender":"female","uin":495456232,"country":"中国","city":"深圳"}],"ginfo":{"face":0,"memo":"http://hujj009.ys168.com\r\n0086+区(没0)+电话\r\n0086+手机\r\nhttp://john123951.xinwen365.net/qq/index.htm","class":395,"fingermemo":"","code":3943922314,"createtime":1079268574,"flag":16778241,"level":0,"name":"ぁQQぁ","gid":3931577475,"owner":3964575484,"members":[{"muin":3964575484,"mflag":192},{"muin":2081397472,"mflag":65},{"muin":3123065696,"mflag":128},{"muin":2609717081,"mflag":0},{"muin":495456232,"mflag":0}],"option":2},"cards":[{"muin":3964575484,"card":"●s.Εx2(22222)□"},{"muin":495456232,"card":"小莎机器人"}],"vipinfo":[{"vip_level":0,"u":3964575484,"is_vip":0},{"vip_level":0,"u":2081397472,"is_vip":0},{"vip_level":0,"u":3123065696,"is_vip":0},{"vip_level":0,"u":2609717081,"is_vip":0},{"vip_level":0,"u":495456232,"is_vip":0}]}}
     :return:dict
     """
     if group_code == 0:
         return
     try:
         url = "http://s.web2.qq.com/api/get_group_info_ext2?gcode=%s&vfwebqq=%s&t=%s" % (
             group_code, self.vfwebqq, int(time.time() * 100))
         response = self.client.get(url)
         rsp_json = json.loads(response)
         logger.debug("get_group_member_info_list info response: {}".format(rsp_json))
         retcode = rsp_json["retcode"]
         if retcode == 0:
             result = rsp_json["result"]
         elif retcode == 6:
             logger.debug("get_group_member_info_list retcode is 6, trying to get true code.")
             result = self.get_group_member_info_list(self.get_true_group_code(group_code))
         else:
             logger.warning("group_code error.")
             return
         self.group_member_info[str(group_code)] = result    # 缓存群成员信息, 此处会把真假group_code都加入cache
         return result
     except Exception as ex:
         logger.warning("RUNTIMELOG get_group_member_info_list. Error: " + str(ex))
         return
开发者ID:Akizukii,项目名称:SmartQQBot,代码行数:29,代码来源:bot.py

示例7: uin_to_account

    def uin_to_account(self, tuin):
        """
        将uin转换成用户QQ号
        :param tuin:
        :return:str 用户QQ号
        """
        uin_str = str(tuin)
        if sql.fetch_one('select account_id from account_data where account_code={0};'.format(uin_str)):
            return sql.fetch_one('select account_id from account_data where account_code={0};'.format(uin_str))[0];
        else:
            try:
                logger.debug("[UIN_TO_ACCOUNT] " + str(tuin))
                info = json.loads(
                    self.client.get(
                        'http://s.web2.qq.com/api/get_friend_uin2?tuin={0}&type=1&vfwebqq={1}&t={2}'.format(
                            uin_str,
                            self.vfwebqq,
                            self.client.get_timestamp()
                        ),
                        SMART_QQ_REFER
                    )
                )
                logger.debug("RESPONSE uin_to_account html:    " + str(info))
                if info['retcode'] != 0:
                    raise TypeError('uin_to_account retcode error')
                info = info['result']['account']
                if sql.fetch_one('select * from account_data where account_id={0};'.format(info)):
                    sql.execute('update account_data set account_code={0} where account_id={1};'.format(uin_str,info))
                else:
                    sql.execute("insert into account_data(account_id,account_code) values('{0}','{1}');".format(info,uin_str))
                return info

            except Exception:
                logger.exception("RUNTIMELOG uin_to_account fail")
                return None
开发者ID:Ricky-Hao,项目名称:SmartQQBot,代码行数:35,代码来源:bot.py

示例8: get_group_name_list_mask2

    def get_group_name_list_mask2(self):
        """
        获取群列表
        get_group_name_list_mask2
        :return:list
        """
        logger.info("RUNTIMELOG Requesting the group list.")

        response = self.client.post(
            'http://s.web2.qq.com/api/get_group_name_list_mask2',
            {
                'r': json.dumps(
                    {
                        "vfwebqq": self.vfwebqq,
                        "hash": self._hash_digest(self._self_info['uin'], self.ptwebqq),
                    }
                )
            },
        )
        try:
            response = json.loads(response)
        except ValueError:
            logger.warning("RUNTIMELOG The response of group list request can't be load as json")
            return
        logger.debug("RESPONSE get_group_name_list_mask2 html:    " + str(response))
        if response['retcode'] != 0:
            raise TypeError('get_online_buddies2 result error')
        return response['result']
开发者ID:sometumi,项目名称:SmartQQBot,代码行数:28,代码来源:bot.py

示例9: get_online_buddies2

    def get_online_buddies2(self):
        """
        获取在线好友列表
        get_online_buddies2
        :return:list
        """
        try:
            logger.info("RUNTIMELOG Requesting the online buddies.")
            online_buddies = json.loads(self.client.get(
                    'http://d1.web2.qq.com/channel/get_online_buddies2?vfwebqq={0}&clientid={1}&psessionid={2}&t={3}'
                        .format(
                            self.vfwebqq,
                            self.client_id,
                            self.psessionid,
                            self.client.get_timestamp()),
            ))
            logger.debug("RESPONSE get_online_buddies2 html:    " + str(online_buddies))
            if online_buddies['retcode'] != 0:
                raise TypeError('get_online_buddies2 result error')
            online_buddies = online_buddies['result']
            return online_buddies

        except:
            logger.warning("RUNTIMELOG get_online_buddies2 fail")
            return None
开发者ID:sometumi,项目名称:SmartQQBot,代码行数:25,代码来源:bot.py

示例10: send_group_msg

 def send_group_msg(self, reply_content, group_code, msg_id, fail_times=0):
     fix_content = str(reply_content.replace("\\", "\\\\\\\\").replace("\n", "\\\\n").replace("\t", "\\\\t"))
     rsp = ""
     try:
         logger.info("Starting send group message: %s" % reply_content)
         req_url = "http://d1.web2.qq.com/channel/send_qun_msg2"
         data = (
             ('r',
              '{{"group_uin":{0}, "face":564,"content":"[\\"{4}\\",[\\"font\\",{{\\"name\\":\\"Arial\\",\\"size\\":\\"10\\",\\"style\\":[0,0,0],\\"color\\":\\"000000\\"}}]]","clientid":{1},"msg_id":{2},"psessionid":"{3}"}}'.format(
                      group_code, self.client_id, msg_id, self.psessionid, fix_content)),
             ('clientid', self.client_id),
             ('psessionid', self.psessionid)
         )
         rsp = self.client.post(req_url, data, SMART_QQ_REFER)
         rsp_json = json.loads(rsp)
         if 'retcode' in rsp_json and rsp_json['retcode'] not in MESSAGE_SENT:
             raise ValueError("RUNTIMELOG reply group chat error" + str(rsp_json['retcode']))
         logger.info("RUNTIMELOG send_qun_msg: Reply '{}' successfully.".format(reply_content))
         logger.debug("RESPONSE send_qun_msg: Reply response: " + str(rsp))
         return rsp_json
     except:
         logger.warning("RUNTIMELOG send_qun_msg fail")
         if fail_times < 5:
             logger.warning("RUNTIMELOG send_qun_msg: Response Error.Wait for 2s and Retrying." + str(fail_times))
             logger.debug("RESPONSE send_qun_msg rsp:" + str(rsp))
             time.sleep(2)
             self.send_group_msg(reply_content, group_code, msg_id, fail_times + 1)
         else:
             logger.warning("RUNTIMELOG send_qun_msg: Response Error over 5 times.Exit.reply content:" + str(reply_content))
             return False
开发者ID:Akizukii,项目名称:SmartQQBot,代码行数:30,代码来源:bot.py

示例11: get_group_name_list_mask2

    def get_group_name_list_mask2(self):
        """
        获取群列表
        get_group_name_list_mask2
        {u'gmarklist': [], u'gmasklist': [], u'gnamelist': [{u'code': 2676518731, u'flag': 1090520065, u'gid': 222968641(这是group_uin), u'name': u'测试'}]}
        :return:dict
        """
        logger.info("RUNTIMELOG Requesting the group list.")

        response = self.client.post(
            'http://s.web2.qq.com/api/get_group_name_list_mask2',
            {
                'r': json.dumps(
                    {
                        "vfwebqq": self.vfwebqq,
                        "hash": self._hash_digest(self._self_info['uin'], self.ptwebqq),
                    }
                )
            },
        )
        try:
            response = json.loads(response)
        except ValueError:
            logger.warning("RUNTIMELOG The response of group list request can't be load as json")
        logger.debug("RESPONSE get_group_name_list_mask2 html:    " + str(response))
        if response['retcode'] != 0:
            raise TypeError('get_online_buddies2 result error')
        return response['result']
开发者ID:wantongtang,项目名称:SmartQQBot,代码行数:28,代码来源:bot.py

示例12: get_discuss_info

 def get_discuss_info(self, did):
     """
     获取指定讨论组的成员信息
     :did: str
     {u'result': {u'info': {u'did': 2966596468, u'discu_name': u'', u'mem_list': [{u'ruin': 466331599, u'mem_uin': 466331599}, {u'ruin': 493658515, u'mem_uin': 556813270}, {u'ruin': 824566900, u'mem_uin': 2606746705}]}, u'mem_status': [], u'mem_info': [{u'nick': u'\\u54a6', u'uin': 466331599}, {u'nick': u'Auro', u'uin': 556813270}, {u'nick': u'-', u'uin': 2606746705}]}, u'retcode': 0}
     :rtype: dict
     """
     if did == 0:
         return
     try:
         did = str(did)
         url = "http://d1.web2.qq.com/channel/get_discu_info?did={did}&psessionid={psessionid}&vfwebqq={vfwebqq}&clientid={clientid}&t={t}".format(
             did=did, psessionid=self.psessionid, vfwebqq=self.vfwebqq, clientid=self.client_id,
             t=int(time.time() * 100)
         )
         response = self.client.get(url)
         rsp_json = json.loads(response)
         logger.debug("get_discuss_info response: {}".format(rsp_json))
         retcode = rsp_json["retcode"]
         if retcode == 0:
             result = rsp_json["result"]
         else:
             logger.warning("get_discuss_info error.")
             return
         self.discuss_info[str(did)] = result  # 缓存群成员信息, 此处会把真假group_code都加入cache
         return result
     except Exception as ex:
         logger.warning("get_discuss_info error: " + str(ex))
         return
开发者ID:SKnife,项目名称:SmartQQBot,代码行数:29,代码来源:bot.py

示例13: send_friend_msg

 def send_friend_msg(self, reply_content, uin, msg_id, fail_times=0):
     fix_content = str(reply_content.replace("\\", "\\\\\\\\").replace("\n", "\\\\n").replace("\t", "\\\\t"))
     rsp = ""
     try:
         req_url = "http://d1.web2.qq.com/channel/send_buddy_msg2"
         data = (
             ('r',
              '{{"to":{0}, "face":594, "content":"[\\"{4}\\", [\\"font\\", {{\\"name\\":\\"Arial\\", \\"size\\":\\"10\\", \\"style\\":[0, 0, 0], \\"color\\":\\"000000\\"}}]]", "clientid":{1}, "msg_id":{2}, "psessionid":"{3}"}}'.format(
                      uin, self.client_id, msg_id, self.psessionid, fix_content)),
             ('clientid', self.client_id),
             ('psessionid', self.psessionid)
         )
         rsp = self.client.post(req_url, data, SMART_QQ_REFER)
         rsp_json = json.loads(rsp)
         if 'errCode' in rsp_json and rsp_json['errCode'] != 0:
             raise ValueError("reply pmchat error" + str(rsp_json['retcode']))
         logger.info("RUNTIMELOG Reply successfully.")
         logger.debug("RESPONSE Reply response: " + str(rsp))
         return rsp_json
     except:
         if fail_times < 5:
             logger.warning("RUNTIMELOG Response Error.Wait for 2s and Retrying." + str(fail_times))
             logger.debug("RESPONSE " + str(rsp))
             time.sleep(2)
             self.send_friend_msg(reply_content, uin, msg_id, fail_times + 1)
         else:
             logger.warning("RUNTIMELOG Response Error over 5 times.Exit.reply content:" + str(reply_content))
             return False
开发者ID:Akizukii,项目名称:SmartQQBot,代码行数:28,代码来源:bot.py

示例14: update_help_data

def update_help_data():
    for p in plugin_list:
        if p!=plugin_name:
            try:
                tmp=(__import__('smart_qq_plugins.'+p,fromlist=['HELP']))
                logger.debug(tmp.HELP)
                sql.execute("insert into Help(plugin_name,help) values('{0}','{1}');".format(p,json.dumps(tmp.HELP))) 
            except Exception as e:
                logger.debug(e)
开发者ID:Ricky-Hao,项目名称:SmartQQBot,代码行数:9,代码来源:Help.py

示例15: get

 def get(self, url, refer=None):
     try:
         req = requests.get(url,headers={"Referer":refer or SMART_QQ_REFER})
         tmp_req = self._opener.get(url,headers={"Referer":refer or SMART_QQ_REFER})
         self._cookie.save(COOKIE_FILE, ignore_discard=True,ignore_expires=True)
         #logger.debug(tmp_req.text)
         return tmp_req.text
     except requests.HTTPError as e:
         logger.debug(e)
         return e
开发者ID:Ricky-Hao,项目名称:SmartQQBot,代码行数:10,代码来源:http_client.py


注:本文中的smart_qq_bot.logger.logger.debug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。