MCPcopy Create free account
hub / github.com/DVampire/FinAgent / check_china_ips

Function check_china_ips

finagent/utils/get_proxy.py:8–22  ·  view source on GitHub ↗

检测ip的方法

(proxies_list)

Source from the content-addressed store, hash-verified

6
7
8def check_china_ips(proxies_list):
9 """检测ip的方法"""
10 headers = {
11 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36'}
12
13 can_use = []
14 for proxy in tqdm(proxies_list, desc="Checking ips"):
15 try:
16 response = requests.get('http://www.baidu.com', headers=headers, proxies=proxy, timeout=1) # 超时报错
17 if response.status_code == 200:
18 can_use.append(proxy)
19 except Exception as error:
20 # print(error)
21 pass
22 return can_use
23
24
25def check_us_ips(proxies_list):

Callers 1

get_china_free_proxyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected