当我在家里运行这个脚本时,我得到了我需要的结果,但是当我在公司网络上运行它时它不起作用我得到 WinError 10060,我尝试了不同的代理和everythign,但无法让它运行,我需要它在公司网络上运行,因为这是语音技术人员将运行脚本的地方。
如果有人能指出我正确的方向,我将不胜感激。
import sys, http.client
showlines = 50
npa = []
try:
servername = sys.argv[1]
except:
servername = 'localcallingguide.com'
server = http.client.HTTPConnection(servername)
for i in range(1000):
if i < 10:
npa.append('00' + str(i))
elif i >= 10 and i < 100:
npa.append('0' + str(i))
else:
npa.append(str(i))
for i in range(len(npa)):
filename = '/lca_rcdist.php?npa1=503&nxx1=745&npa2=503&nxx2=' + npa[i]
server.putrequest('GET', filename)
server.putheader('Accept', 'text/html')
server.endheaders()
reply = server.getresponse()
if reply.status != 200:
print('Error sending request', reply.status, reply.reason)
else:
data = reply.readlines()
reply.close()
for line in data[:showlines]:
cLine = line.decode('utf-8')
if '"ofrom">N<' in cLine:
print('NXX ,' + npa[i])