From 01ea4cd54300bb033b9aaf7d7f5e602b42d48ce3 Mon Sep 17 00:00:00 2001 From: Relakkes Date: Mon, 12 Aug 2024 00:14:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3IpInfoModel=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E5=AF=BC=E5=85=A5=E4=BE=9D=E8=B5=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy/base_proxy.py | 5 +++-- tools/crawler_util.py | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) 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}",