コード例 #1
0
 def linkWithProxy(self, line):
     lineList = line.split('\t')
     protocol = lineList[3].lower()
     server = protocol + r'://' + lineList[1] + ':' + lineList[2]
     opener = Request.build_opener(Request.ProxyHandler({protocol: server}))
     request.install_opener(opener)
     try:
         response = Request.urlopen(self.URL, timeout=self.timeout)
     except:
         print('%s connect failed!\n' % server)
         return
     else:
         try:
             strRe = response.read()
         except:
             print('%s connect failed!\n' % server)
             return
         if self.regex.search(str(strRe)):
             print('%s connect success!£¡£¡£¡£¡£¡£¡\n' % server)
             self.aliveList.append(line)