diff --git a/proxy/base_proxy.py b/proxy/base_proxy.py index 9294008..4412f01 100644 --- a/proxy/base_proxy.py +++ b/proxy/base_proxy.py @@ -10,7 +10,7 @@ from typing import List import config from cache.abs_cache import AbstractCache from cache.cache_factory import CacheFactory -from tools import utils +from tools.utils import utils from .types import IpInfoModel @@ -27,7 +27,8 @@ class ProxyProvider(ABC): :param num: 提取的 IP 数量 :return: """ - pass + raise NotImplementedError + class IpCache: diff --git a/tools/crawler_util.py b/tools/crawler_util.py index c17fc45..568b221 100644 --- a/tools/crawler_util.py +++ b/tools/crawler_util.py @@ -13,8 +13,6 @@ import httpx from PIL import Image, ImageDraw from playwright.async_api import Cookie, Page -from proxy import IpInfoModel - from . import utils @@ -137,7 +135,7 @@ def match_interact_info_count(count_str: str) -> int: return 0 -def format_proxy_info(ip_proxy_info: IpInfoModel) -> Tuple[Optional[Dict], Optional[Dict]]: +def format_proxy_info(ip_proxy_info) -> Tuple[Optional[Dict], Optional[Dict]]: """format proxy info for playwright and httpx""" playwright_proxy = { "server": f"{ip_proxy_info.protocol}{ip_proxy_info.ip}:{ip_proxy_info.port}",