code: def send(self):
          
          log = logging.getLogger(self.cls_logger + '.send')
  
          if self.attachments:
              self.payload['attachments'] = self.attachments
  
          # Encode payload in JSON
          log.debug('Using payload: %s', self.payload)
          try:
              json_payload = json.JSONEncoder().encode(self.payload)
          except(TypeError, ValueError, OverflowError):
              _, ex, trace = sys.exc_info()
              msg = 'There was a problem encoding the JSON payload\n{e}'.format(e=str(ex))
              raise OSError, msg, trace
          else:
              log.debug('JSON payload: %s', json_payload)
  
          # Post to Slack!
          log.debug('Posting message to Slack...')
          try:
              result = requests.post(url=self.webhook_url, data=json_payload)
          except requests.exceptions.ConnectionError:
              _, ex, trace = sys.exc_info()
              msg = '{n}: There was a problem posting to Slack\n{e}'.format(n=ex.__class__.__name__, e=str(ex))
              raise OSError, msg, trace
  
          # Check return code
          if result.status_code != 200:
              log.error('Slack post to url {u} failed with code: {c}'.format(c=result.status_code, u=self.webhook_url))
          else:
              log.debug('Posted message to Slack successfully.')
  
          # Clear out attachments after sending
          self.attachments = []
          self.payload.pop('attachments', None)
docs: Sends the Slack message
  
          This public method sends the Slack message along with any
          attachments, then clears the attachments array.
  
          :return: None
          :raises: OSError