Handle a ZAP request.
353530
async def on_request(
        self,
        domain,
        address,
        identity,
        mechanism,
        credentials,
    ):
        
        logger.debug(
            "Request in domain %s for %s (%r): %r (%r)",
            domain,
            address,
            identity,
            mechanism,
            credentials,
        )

        user_id = None
        metadata = {}

        if self.whitelist:
            if address not in self.whitelist:
                raise ZAPAuthenticationFailure(
                    "IP address is not in the whitelist",
                )
        elif self.blacklist:
            if address in self.blacklist:
                raise ZAPAuthenticationFailure("IP address is blacklisted")

        if mechanism == b'PLAIN':
            username = credentials[0].decode('utf-8')
            password = credentials[1].decode('utf-8')
            ref_password = self.passwords.get(username)

            if not ref_password:
                raise ZAPAuthenticationFailure("No such user %r" % username)

            if password != ref_password:
                raise ZAPAuthenticationFailure(
                    "Invalid password for user %r" % username,
                )

            user_id = username

        elif mechanism == b'CURVE':
            public_key = credentials[0]

            if public_key not in self.authorized_keys:
                raise ZAPAuthenticationFailure(
                    "Unauthorized key %r" % public_key,
                )

        return user_id, metadata
675358
def do_request(self, request, proxies, timeout, **_):
        """"""
        print('{0} {1}'.format(request.method, request.url))
        response = self.http.send(request, proxies=proxies, timeout=timeout,
                                  allow_redirects=False)
        response.raw = None  # Make pickleable
        return response
642887
def handle_one_request(self):
        """"""
        self.raw_requestline = self.rfile.readline()
        if not self.raw_requestline:
            self.close_connection = 1
        elif self.parse_request():
            return self.run_wsgi()
869496
def handle_status(self):
        """"""
        status = self.get_status()

        if status:
            # Update main-zone
            self.zones['main'].update_status(status)
131567
def handleRequest(self, obj, socket, multi=False):
        '''
        
        '''
        while 1:
            try:
                msg = socket.recv_multipart(zmq.NOBLOCK)
                method = msg[0].decode()
                try:
                    args = pickle.loads(msg[1], **pickle_options)
                except ValueError as err:
                    self._logger.notice('Request %s failed. Caught %s %s' %
                                        (method, type(err), str(err)))
                    self._sendAnswer(socket, err)
                self._logger.debug("received request %s %s" %
                                   (method, str(args)))
                try:
                    res= getattr(obj, method).__call__(*args)
                except Exception as e:
                    self._logger.notice('Request %s %s failed. Caught %s %s' %
                                        (method, str(args), type(e), str(e)))
                    res= e
                self._sendAnswer(socket, res)
            except zmq.ZMQError:
                return
            except Exception as e:
                self._logger.error("Unknown error %s" % str(e))
            if not multi:
                break
423715
def on_get(self, req, resp, **kwargs):
        """"""
        return super().on_get(
            req, resp, handler=self._retrieve, **kwargs
        )
192331
def handle(self):
        """"""
        body = None
        req = self.request
        res = self.response
        rou = self.router
        con = None
        start = time.time()

        try:
            con = self.create_controller()
            con.call = self
            self.controller = con
            if not self.quiet:
                con.log_start(start)

            # the controller handle method will manipulate self.response, it first
            # tries to find a handle_HTTP_METHOD method, if it can't find that it
            # will default to the handle method (which is implemented on Controller).
            # method arguments are passed in so child classes can add decorators
            # just like the HTTP_METHOD that will actually handle the request
            controller_args, controller_kwargs = con.find_method_params()
            controller_method = getattr(con, "handle_{}".format(req.method), None)
            if not controller_method:
                controller_method = getattr(con, "handle")

            if not self.quiet:
                logger.debug("Using handle method: {}.{}".format(
                    con.__class__.__name__,
                    controller_method.__name__
                ))
            controller_method(*controller_args, **controller_kwargs)

        except Exception as e:
            self.handle_error(e) # this will manipulate self.response

        finally:
            if res.code == 204:
                res.headers.pop('Content-Type', None)
                res.body = None # just to be sure since body could've been ""

            if con:
                if not self.quiet:
                    con.log_stop(start)

        return res
744934
def handle_action(self, channel, nick, msg):
		""

		messages = ()
		for handler in Handler.find_matching(msg, channel):
			exception_handler = functools.partial(
				self._handle_exception,
				handler=handler,
			)
			rest = handler.process(msg)
			client = connection = event = None
			# for regexp handlers
			match = rest
			f = handler.attach(locals())
			results = pmxbot.itertools.generate_results(f)
			clean_results = pmxbot.itertools.trap_exceptions(results, exception_handler)
			messages = itertools.chain(messages, clean_results)
			if not handler.allow_chain:
				break
		self._handle_output(channel, messages)
703507
def spider_url(zap_helper, url, context_name, user_name):
    """"""
    console.info('Running spider...')
    with helpers.zap_error_handler():
        zap_helper.run_spider(url, context_name, user_name)
1368831
async def handler(event):
    """"""
    await asyncio.wait([
        event.delete(),
        event.respond(OFFTOPIC[event.chat_id], reply_to=event.reply_to_msg_id)
    ])
249881
def handle(self, msg):
        """"""
        debug_msg = ': {!r}'.format(msg) if self.debug else ''
        log.debug('request: %d bytes%s', len(msg), debug_msg)
        buf = io.BytesIO(msg)
        code, = util.recv(buf, '>B')
        if code not in self.methods:
            log.warning('Unsupported command: %s (%d)', msg_name(code), code)
            return failure()

        method = self.methods[code]
        log.debug('calling %s()', method.__name__)
        reply = method(buf=buf)
        debug_reply = ': {!r}'.format(reply) if self.debug else ''
        log.debug('reply: %d bytes%s', len(reply), debug_reply)
        return reply
1269975
def trigger(self, *args, **kwargs):
        """"""
        for h in self.handlers:
            h(*args, **kwargs)
48996
def _handle(self, event_handler, event_name, user_args, event_timeout,
                cond, cond_timeout):
        
        if cond:
            cond.wait(cond_timeout)
        event = self.pop_event(event_name, event_timeout)
        return event_handler(event, *user_args)
828883
def handle(self, *args, **options):
        

        # Load the settings
        self.require_settings(args, options)

        # Load your AWS credentials from ~/.aws/credentials
        self.load_credentials()

        # Invoke it!
        command = {"command": ' '.join(options['environment'][1:])}

        response = self.zappa.invoke_lambda_function(
            self.lambda_name, json.dumps(command), invocation_type='RequestResponse')

        if 'LogResult' in response:
            print(base64.b64decode(response['LogResult']))
        else:
            print(response)
            import pdb
            pdb.set_trace()

        return
375096
def _request(self, url, **kwargs):
        '''
        '''
        response = super(Bounces, self)._request(url, **kwargs)
        self._last_response = response
        return response
439842
public function RequestHandle()
    {
        if (\Zippy\WebApplication::$app->getRequest()->isBinaryRequest()) {
            $this->binaryOutput();
        }
        if (\Zippy\WebApplication::$app->getRequest()->isAjaxRequest()) {
            $this->Refresh();
            \Zippy\WebApplication::$app->getResponse()->addAjaxResponse($this->AjaxAnswer());
        }
    }
489055
def active_scan(zap_helper, url, scanners, recursive, context_name, user_name):
    
    console.info('Running an active scan...')

    with helpers.zap_error_handler():
        if scanners:
            zap_helper.set_enabled_scanners(scanners)

        zap_helper.run_active_scan(url, recursive, context_name, user_name)