Пример #1
0
    def render_POST(self, request):

        """

        :param request:
        :return:
        """

        result = IDispatcher(Validator(request.content.read())).dispatch()
        result_response = DispathcherResultHelper(result)
        return result_response.result_validation(None, None, 'WEB')
Пример #2
0
    def lineReceived(self, line):
        """
        A callback method that is fired when live is received.
        Will validate, dispatch and choose the right API on the fly
        :param line: user input
        :type line: JSON
        :return: void
        """
        self.__logger.info('Received line: {}'.format(line))

        result = IDispatcher(Validator(line)).dispatch()
        result_helper = DispathcherResultHelper(result)

        result_helper.result_validation(self.sendLine,
                                        self.transport.loseConnection, 'TCP')
Пример #3
0
    def lineReceived(self, line):
        """
        A callback method that is fired when live is received.
        Will validate, dispatch and choose the right API on the fly
        :param line: user input
        :type line: JSON
        :return: void
        """
        self.__logger.info('Received line: {}'.format(line))

        result = IDispatcher(Validator(line)).dispatch()
        result_helper = DispathcherResultHelper(result)

        result_helper.result_validation(
            self.sendLine,
            self.transport.loseConnection,
            'TCP'
        )
Пример #4
0
    def onMessage(self, payload, is_binary):
        """
        A callback that fired when message is arrived
        :param payload:
        :param is_binary:

        :return:
        """
        if is_binary:

            logger.info("Binary message received: {0} bytes".format(
                len(payload)))
            self.dropConnection('not supported')

        else:

            result = IDispatcher(Validator(payload.decode('utf8'))).dispatch()
            result_helper = DispathcherResultHelper(result)

            result_helper.result_validation(self.sendMessage,
                                            self.dropConnection, 'WS')
Пример #5
0
    def onMessage(self, payload, is_binary):

        """
        A callback that fired when message is arrived
        :param payload:
        :param is_binary:

        :return:
        """
        if is_binary:

            logger.info("Binary message received: {0} bytes".format(len(payload)))
            self.dropConnection('not supported')

        else:

            result = IDispatcher(Validator(payload.decode('utf8'))).dispatch()
            result_helper = DispathcherResultHelper(result)

            result_helper.result_validation(
                self.sendMessage,
                self.dropConnection,
                'WS'
            )