else: req = client.get( url, headers=data.headers, cookies=data.cookies, allow_redirects=False, ) resp = await req self.assert_proccess(resp, data) pure_info = target.send( (self.name, key, resp, HTML(html=resp.text), data, self.debug)) await self.loop_images(client, pure_info) self.datas[key] = pure_info status_print( resp, f"[+]{key.ljust(10)} ({resp.status_code}){resp.url}: {pure_info._title}", ) except AssertionError: pass except Exception as e: self.datas[key] = {"error": f"{e.__class__.__name__}: {e}"} def assert_proccess(self, resp: httpx.Response, data: person) -> None: """ check what if data is ok arguments resp: response from server data: extra target config """ def single(data: person) -> None: _type, _msg = data
def test_status_print_unknown(self): _ = common.status_print(Box({"status_code": 666}), "666 status code") self.assertEqual(_, None)
def test_status_print_4(self): _ = common.status_print(Box({"status_code": 401}), "401 status code") self.assertEqual(_, None)
def test_status_print_5(self): _ = common.status_print(Box({"status_code": 502}), "502 status code") self.assertEqual(_, None)
def test_status_print_3(self): _ = common.status_print(Box({"status_code": 304}), "304 status code") self.assertEqual(_, None)