def send(self, message):
        """Send our message

        Args:
            message (str): The message to be sent.

        Returns:
            requests.models.Response: The response from the request.

        """
        body = {
            'notificationType': self._notification_type,
            'priority': self._priority,
            'isOrganization': self._is_organization,
            'message': message,
        }

        if self._recipients:
            body['recipients'] = self._recipients

        self._tcex.log.debug('notification body: {}'.format(json.dumps(body)))

        # create our tcex resource
        resource = resource = self._tcex.resource('Notification')
        resource.http_method = 'POST'
        resource.body = json.dumps(body)

        results = resource.request()  # do the request
        if results.get('response').status_code == 200:
            # everything worked
            response = results.get('response').json()
        elif results.get('response').status_code == 400:
            # failed..but known... user doesn't exist
            # just return and let calling app handle it
            err = 'Failed to send notification ({})'.format(results.get('response').text)
            self._tcex.log.error(err)
            response = results.get('response').json()
        else:
            # somekind of unknown error...raise
            err = 'Failed to send notification ({})'.format(results.get('response').text)
            self._tcex.log.error(err)
            raise RuntimeError(err)
        return response
def send ( self , message ) : body = { 'notificationType' : self . _notification_type , 'priority' : self . _priority , 'isOrganization' : self . _is_organization , 'message' : message , } if self . _recipients : body [ 'recipients' ] = self . _recipients self . _tcex . log . debug ( 'notification body: {}' . format ( json . dumps ( body ) ) ) resource = resource = self . _tcex . resource ( 'Notification' ) resource . http_method = 'POST' resource . body = json . dumps ( body ) results = resource . request ( ) if results . get ( 'response' ) . status_code == 200 : response = results . get ( 'response' ) . json ( ) elif results . get ( 'response' ) . status_code == 400 : err = 'Failed to send notification ({})' . format ( results . get ( 'response' ) . text ) self . _tcex . log . error ( err ) response = results . get ( 'response' ) . json ( ) else : err = 'Failed to send notification ({})' . format ( results . get ( 'response' ) . text ) self . _tcex . log . error ( err ) raise RuntimeError ( err ) return response
Send our message

        Args:
            message (str): The message to be sent.

        Returns:
            requests.models.Response: The response from the request.