station.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:QRadio 作者: QTek 项目源码 文件源码
def parser(self, response):
        if response:
            match = re.findall(r'API limit', response.text) #
            if match:
                self.error_log.error_log('Sorry API Limit reached (300 q/month). Get new: https://totalhash.cymru.com/contact-us/',
                                         self.station_name)
                return []

            xml_dict = xmltodict.parse(response.text)
            if 'response' in xml_dict:
                if 'result' in xml_dict['response']:
                    if 'doc' in xml_dict['response']['result']:
                        try:
                            response = xml_dict['response']['result'] # Unpacking xmltodict
                            for records in response['doc']:
                                self.hash_list.append(records['str']['#text']) # Append hash_values
                        except: pass
        return self.hash_list # Return empty
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号