MCPcopy Index your code
hub / github.com/Python3WebSpider/ProxyPool / is_valid_proxy

Function is_valid_proxy

proxypool/utils/proxy.py:4–16  ·  view source on GitHub ↗

check this string is within proxy format

(data)

Source from the content-addressed store, hash-verified

2
3
4def is_valid_proxy(data):
5 """
6 check this string is within proxy format
7 """
8 if is_auth_proxy(data):
9 host, port = extract_auth_proxy(data)
10 return is_ip_valid(host) and is_port_valid(port)
11 elif data.__contains__(':'):
12 ip = data.split(':')[0]
13 port = data.split(':')[1]
14 return is_ip_valid(ip) and is_port_valid(port)
15 else:
16 return is_ip_valid(data)
17
18
19def is_ip_valid(ip):

Callers 2

addMethod · 0.90
convert_proxy_or_proxiesFunction · 0.85

Calls 4

is_auth_proxyFunction · 0.85
extract_auth_proxyFunction · 0.85
is_ip_validFunction · 0.85
is_port_validFunction · 0.85

Tested by

no test coverage detected