Пример #1
0
def start_tx_spider():
    tx = TXSpider()
    tx.log.logging.info("start tx spider success-----")
    while True:
        tx.main()
        time.sleep(TIME_SPLIT)
 def setUp(self) -> None:
     self.sp = TXSpider()
    def setUp(self) -> None:
        self.sp = TXSpider()
        self.data1 = [{
            "country": "中国",
            "area": "湖北",
            "city": "武汉",
            "confirm": 618,
            "suspect": 0,
            "dead": 45,
            "heal": 40
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "黄冈",
            "confirm": 122,
            "suspect": 0,
            "dead": 2,
            "heal": 2
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "孝感",
            "confirm": 55,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "荆门",
            "confirm": 38,
            "suspect": 0,
            "dead": 1,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "恩施州",
            "confirm": 17,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "荆州",
            "confirm": 33,
            "suspect": 0,
            "dead": 2,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "仙桃",
            "confirm": 11,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "十堰",
            "confirm": 20,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "随州",
            "confirm": 36,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "天门",
            "confirm": 5,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "宜昌",
            "confirm": 20,
            "suspect": 0,
            "dead": 1,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "鄂州",
            "confirm": 1,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "咸宁",
            "confirm": 43,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "广东",
            "city": "广州",
            "confirm": 17,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "加拿大",
            "area": "",
            "city": "",
            "confirm": 1,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "法国",
            "area": "",
            "city": "",
            "confirm": 3,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }]

        self.data2 = [{
            "country": "中国",
            "area": "湖北",
            "city": "武汉",
            "confirm": 698,
            "suspect": 0,
            "dead": 45,
            "heal": 40
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "黄冈",
            "confirm": 122,
            "suspect": 0,
            "dead": 2,
            "heal": 2
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "孝感",
            "confirm": 55,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "荆门",
            "confirm": 38,
            "suspect": 0,
            "dead": 1,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "恩施州",
            "confirm": 17,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "荆州",
            "confirm": 33,
            "suspect": 0,
            "dead": 2,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "仙桃",
            "confirm": 11,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "十堰",
            "confirm": 20,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "随州",
            "confirm": 36,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "天门",
            "confirm": 5,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "宜昌",
            "confirm": 20,
            "suspect": 0,
            "dead": 1,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "鄂州",
            "confirm": 1,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "湖北",
            "city": "咸宁",
            "confirm": 43,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "广东",
            "city": "广州",
            "confirm": 17,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "加拿大",
            "area": "",
            "city": "",
            "confirm": 2,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "法国",
            "area": "",
            "city": "",
            "confirm": 3,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }, {
            "country": "中国",
            "area": "重庆",
            "city": "重庆",
            "confirm": 3,
            "suspect": 0,
            "dead": 0,
            "heal": 0
        }]

        self.update_city = [{
            "country": "中国",
            "area": "辽宁",
            "city": "沈阳",
            "confirm": 8,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 1,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "area": "天津",
            "confirm": 24,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "city": "天津",
            "n_confirm": 1,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "辽宁",
            "city": "丹东",
            "confirm": 5,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 1,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "上海",
            "city": "外地来沪",
            "confirm": 33,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 33,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "上海",
            "city": "浦东",
            "confirm": 9,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 9,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "上海",
            "city": "长宁",
            "confirm": 5,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 5,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "上海",
            "city": "静安",
            "confirm": 5,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 5,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "上海",
            "city": "徐汇",
            "confirm": 3,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 3,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "上海",
            "city": "虹口",
            "confirm": 2,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 2,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "上海",
            "city": "闵行",
            "confirm": 2,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 2,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "上海",
            "city": "青浦",
            "confirm": 2,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 2,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "上海",
            "city": "黄埔",
            "confirm": 2,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 2,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "上海",
            "city": "宝山",
            "confirm": 1,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 1,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "上海",
            "city": "嘉定",
            "confirm": 1,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 1,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "上海",
            "city": "奉贤",
            "confirm": 1,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 1,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "country": "中国",
            "area": "辽宁",
            "city": "辽阳",
            "confirm": 1,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "n_confirm": 1,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "area": "辽宁",
            "confirm": 30,
            "suspect": 0,
            "dead": 0,
            "heal": 0,
            "city": "辽宁",
            "n_confirm": 3,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }, {
            "confirm": 4533,
            "dead": 106,
            "heal": 60,
            "suspect": 6973,
            "area": "全国",
            "country": "全国",
            "city": "全国",
            "n_confirm": 4,
            "n_suspect": 0,
            "n_dead": 0,
            "n_heal": 0
        }]