def send(self, req_timeout=5, ignore_errors=False): http = HttpGet(self.request, req_timeout, proxy=self._scanner.proxy, useragent=self._scanner.user_agent, extra_headers=self._scanner.extra_headers) cookies = [] if self._scanner.cookies: cookies.extend(self._scanner.cookies) if self.cookie: cookies.extend(self.cookie) #cookies = self.cookie + (self._scanner.cookies if self._scanner.cookies else []) resp = http.send_request(method=self.method, url=self.url, data=self.body, cookies=cookies, ignore_errors=ignore_errors) return MutationResponse(self, resp)
def send_request(self, req, url=None, method=None, data=None, cookies=None, user_agent=None, proxy=None, extra_headers=None, req_timeout=5, ignore_errors=False): if not proxy: proxy = self.proxy if not user_agent: user_agent = self.user_agent if not extra_headers: extra_headers = self.extra_headers http = HttpGet(req, req_timeout, proxy=proxy, useragent=user_agent, extra_headers=extra_headers ) #{"proto":"http", "host":"127.0.0.1","port":"8080"}) #http = HttpGet(self.request, req_timeout) allcookies = [] if cookies: allcookies.extend(cookies) if self.cookies: allcookies.extend(self.cookies) http = HttpGet(req, req_timeout, proxy=proxy, useragent=user_agent, extra_headers=extra_headers) return http.send_request(method=method, url=url, data=data, cookies=allcookies, ignore_errors=ignore_errors)
def rawsend(self, url, method=None, data=None, cookies=None, user_agent=None, proxy=None, extra_headers=None, req_timeout=5, ignore_errors=False): if not method: method = METHOD_GET req = Request(REQTYPE_LINK, method, url) http = HttpGet(req, req_timeout, proxy=proxy, useragent=user_agent, extra_headers=extra_headers) return http.send_request(method=method, url=url, data=data, cookies=cookies, ignore_errors=ignore_errors)