amazon_dash/execute.py
def validate(self):
        """Check self.data. Raise InvalidConfig on error

        :return: None
        """
        if (self.data.get('content-type') or self.data.get('body')) and \
                self.data.get('method', '').lower() not in CONTENT_TYPE_METHODS:
            raise InvalidConfig(
                extra_body='The body/content-type option only can be used with the {} methods. The device is {}. '
                           'Check the configuration file.'.format(', '.join(CONTENT_TYPE_METHODS), self.name)
            )
        self.data['content-type'] = CONTENT_TYPE_ALIASES.get(self.data.get('content-type'),
                                                             self.data.get('content-type'))
        form_type = CONTENT_TYPE_ALIASES['form']
        if self.data.get('body') and (self.data.get('content-type') or form_type) == form_type:
            try:
                self.data['body'] = json.loads(self.data['body'])
            except JSONDecodeError:
                raise InvalidConfig(
                    extra_body='Invalid JSON body on {} device.'.format(self.name)
                )
def validate(self):
        if (self.data.get('content-type') or self.data.get('body')) and \
                self.data.get('method', '').lower() not in CONTENT_TYPE_METHODS:
            raise InvalidConfig(
                extra_body='The body/content-type option only can be used with the {} methods. The device is {}. '
                           'Check the configuration file.'.format(', '.join(CONTENT_TYPE_METHODS), self.name)
            )
        self.data['content-type'] = CONTENT_TYPE_ALIASES.get(self.data.get('content-type'),
                                                             self.data.get('content-type'))
        form_type = CONTENT_TYPE_ALIASES['form']
        if self.data.get('body') and (self.data.get('content-type') or form_type) == form_type:
            try:
                self.data['body'] = json.loads(self.data['body'])
            except JSONDecodeError:
                raise InvalidConfig(
                    extra_body='Invalid JSON body on {} device.'.format(self.name)
                )
def validate ( self ) : if ( self . data . get ( 'content-type' ) or self . data . get ( 'body' ) ) and self . data . get ( 'method' , '' ) . lower ( ) not in CONTENT_TYPE_METHODS : raise InvalidConfig ( extra_body = 'The body/content-type option only can be used with the {} methods. The device is {}. ' 'Check the configuration file.' . format ( ', ' . join ( CONTENT_TYPE_METHODS ) , self . name ) ) self . data [ 'content-type' ] = CONTENT_TYPE_ALIASES . get ( self . data . get ( 'content-type' ) , self . data . get ( 'content-type' ) ) form_type = CONTENT_TYPE_ALIASES [ 'form' ] if self . data . get ( 'body' ) and ( self . data . get ( 'content-type' ) or form_type ) == form_type : try : self . data [ 'body' ] = json . loads ( self . data [ 'body' ] ) except JSONDecodeError : raise InvalidConfig ( extra_body = 'Invalid JSON body on {} device.' . format ( self . name ) )
Check self.data. Raise InvalidConfig on error

        :return: None
Check self . data . Raise InvalidConfig on error