request.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:webdirfuzz 作者: Fenguopeng 项目源码 文件源码
def send_http(self, url):
        o = urlparse(url)
        r = 0
        try:
            conn = httplib.HTTPConnection(o[1], timeout=self.timeout)
            if o[4]:
                conn.request('GET', o[2] + o[3] + '?' + o[4], headers=self.headers)
            else:
                conn.request('GET', o[2] + o[3], headers=self.headers)
            r = conn.getresponse()
            logger.info('%s %s' % (url, r.status))
            time.sleep(self.delay)
        except (httplib.HTTPException, socket.timeout, socket.gaierror, Exception), e:
            logger.error('url %s is unreachable, Exception %s %s' % (url, e.__class__.__name__, e))
            print 'url %s is unreachable, Exception %s %s' % (url.encode('utf-8'), e.__class__.__name__, e)
            pass
        return r
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号