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

Function check_us_ips

finagent/utils/get_proxy.py:25–39  ·  view source on GitHub ↗

检测ip的方法

(proxies_list)

Source from the content-addressed store, hash-verified

23
24
25def check_us_ips(proxies_list):
26 """检测ip的方法"""
27 headers = {
28 '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'}
29
30 can_use = []
31 for proxy in tqdm(proxies_list, desc="Checking ips"):
32 try:
33 response = requests.get('http://www.google.com', headers=headers, proxies=proxy, timeout=1) # 超时报错
34 if response.status_code == 200:
35 can_use.append(proxy)
36 except Exception as error:
37 # print(error)
38 pass
39 return can_use
40
41
42def get_china_free_proxy(pages=10):

Callers 1

get_us_free_proxyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected