def testExist(): client = SqlClient() sql = 'select url from proxy where tag="b47w"' urls = [i[0] for i in client.engine.execute(sql).fetchall()] print(urls) proxy_queue = Queue() for url in urls: proxy = Proxy(url) proxy.tag = 'b47w' proxy_queue.put(proxy) checker = Checker('raw', proxy_queue, f"thread_01") checker.start() checker.join()
def testProxyClass1(): proxy = Proxy("https://127.0.0.1:8080") print(proxy.to_json) proxy.score = 10 proxy.proxy_type = "test" proxy.tag = "高匿" proxy_str = json.dumps(proxy.to_dict, ensure_ascii=False) print(proxy_str) print(Proxy.createFromJson(proxy_str).to_dict)