Home > Software engineering >  Can only use VBA or Python3.7, how to quickly validate these agents which available IP address?
Can only use VBA or Python3.7, how to quickly validate these agents which available IP address?

Time:09-17


I D packing list has many proxy IP, how to quickly validate these agents which available IP address?

CodePudding user response:

Agreement, there are several sock4 sock5 HTTP, using winsock write one yourself, estimates that even the debugging take about a week,

CodePudding user response:

reference 1st floor bakw response:
agreement, there are several sock4 sock5 HTTP, using winsock write one yourself, estimates that even the debugging take about a week,


Why need so long time,
 # - * - coding: utf-8 - * - 
The import requests
Def gitIp () :
IpList=[]
With open ("../../proxies. TXT ", "r") as f:
IpList=f.r ead (). The split (" \ n ")
# print ipList
# print "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --"
Return ipList


IpList=[' https://39.88.13.3:53281 ',
'https://182.43.203.43:4306',
'https://183.62.71.242:3128',
'https://61.160.208.222:8080',
'https://123.179.28.159:8080',
'https://58.56.90.202:53281',
'https://222.88.144.119:53281',
'https://61.158.111.142:53281',
'https://139.224.24.26:8888',
'https://124.232.148.7:3128',
'https://218.15.23.229:53281',
'https://222.34.139.52:808',
'https://218.18.10.11:9797',
'https://119.136.113.49:9797')
Def valVer (proxys) :
BadNum=0
GoodNum=0
For the proxy proxys in:
Try:
Proxy_host=proxy
Protocol='HTTPS' if 'HTTPS' in proxy_host else 'HTTP'
Proxies={protocol: proxy_host}
The response=requests. Get (' http://www.baidu.com ', proxies=proxies, timeout=2)
If the response status_code!=200:
BadNum +=1
Print proxy_host, 'bad' proxy '
The else:
GoodNum +=1
Print proxy_host, 'success' proxy '
Except the Exception, e:
Print e
# print proxy_host, 'bad' proxy '
BadNum +=1
The continue
Print 'success proxy num:' goodNum
Print 'bad proxy num:' badNum

# # valVer (gitIp (), read the IP in the local file
ValVer (ipList)


Can you help me to change the code?
My IP address in D dish with directory,

CodePudding user response:

Are you sure you are HTTP proxy?

CodePudding user response:

 
# - * - coding: utf-8 - * -
The import requests
Def gitIp (filename) :
IpList=[]
With the open (filename, "r") as f:
IpList=f.r ead (). The split (" \ n ")
# print ipList
# print "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --"
Return ipList

Def valVer (proxys) :
BadNum=0
GoodNum=0
For the proxy proxys in:
Try:
Proxy_host='http://' + proxy
Protocol='HTTP'
Proxies={protocol: proxy_host}
The response=requests. Get (' http://www.baidu.com ', proxies=proxies, timeout=2)
If the response status_code!=200:
BadNum +=1
Print proxy_host, 'bad' proxy '
The else:
GoodNum +=1
Print proxy_host, 'success' proxy '
Except the Exception, e:
Print e
# print proxy_host, 'bad' proxy '
BadNum +=1
The continue
Print 'success proxy num:' goodNum
Print 'bad proxy num:' badNum

ValVer (gitIp (' D: \ \ proxies. TXT)) # read the IP in the local file

CodePudding user response:

reference 4 floor bakw response:
 
# - * - coding: utf-8 - * -
The import requests
Def gitIp (filename) :
IpList=[]
With the open (filename, "r") as f:
IpList=f.r ead (). The split (" \ n ")
# print ipList
# print "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --"
Return ipList

Def valVer (proxys) :
BadNum=0
GoodNum=0
For the proxy proxys in:
Try:
Proxy_host='http://' + proxy
Protocol='HTTP'
Proxies={protocol: proxy_host}
The response=requests. Get (' http://www.baidu.com ', proxies=proxies, timeout=2)
If the response status_code!=200:
BadNum +=1
Print proxy_host, 'bad' proxy '
The else:
GoodNum +=1
Print proxy_host, 'success' proxy '
Except the Exception, e:
Print e
# print proxy_host, 'bad' proxy '
BadNum +=1
The continue
Print 'success proxy num:' goodNum
Print 'bad proxy num:' badNum

ValVer (gitIp (' D: \ \ proxies. TXT)) # read the IP in the local file


You this code is 2. X, I'm sorry I only got 3.7, did not run successfully,
But I used the two-to-three. Py turned for a moment, or go wrong, you don't succeed, don't know why
  •  Tags:  
  • VBA
  • Related