feat: 代理IP缓存到redis中

This commit is contained in:
Relakkes
2023-12-06 23:49:56 +08:00
parent f71d086464
commit c530bd4219
8 changed files with 92 additions and 50 deletions

View File

@@ -2,8 +2,10 @@
# @Author : relakkes@gmail.com
# @Time : 2023/12/2 13:45
# @Desc : ip代理池实现
import json
import pathlib
import random
from typing import List
from typing import Dict, List
import httpx
from tenacity import retry, stop_after_attempt, wait_fixed
@@ -22,7 +24,7 @@ class ProxyIpPool:
async def load_proxies(self) -> None:
"""
从 HTTP 代理商获取 IP 列表
解析
:return:
"""
self.proxy_list = await IpProxy.get_proxies(self.ip_pool_count)