Ejemplo n.º 1
0
 def execute(self, url, method='GET', headers={},body=None):
     request = httputil.ParamHTTPRequest(url,method,headers,body)
     response = None
     try:
         yield blackmamba.resolve(request.host)
         yield blackmamba.connect(request.host, request.port)
         yield blackmamba.write(str(request))
         response = yield blackmamba.read()
         yield blackmamba.close()
     except blackmamba.SockError as e:
         response = e
     
     self.check(
         request=request,
         response=httputil.RawHTTPResponse(response)
     )
Ejemplo n.º 2
0
    def execute(self, url, method='GET', headers={},body=None):
        request = HTTPRequest(url,method,headers,body)
        response = None
        try:
            # to resolve DNS asynchronously, call resolve() prior to connect()
            yield blackmamba.resolve(request.host)
            yield blackmamba.connect(request.host, request.port)
            yield blackmamba.write(str(request))
            response = yield blackmamba.read()
            # close the connection
            yield blackmamba.close()
        except blackmamba.SockError as e:
            response = e

        self.check(
            request=request,
            response=response
        )