code: def login(self, verbose=False):
          '''
          Authenticate with Opsview
          :param verbose: Verbose output mode
          :type verbose: bool
          :return: The authentification token
          :rtype: str or unicode
          '''
          url = '{}/{}'.format(self.rest_url, 'login')
          logger.debug('POST: {}'.format(url))
          r = requests.post(url, json={
                  'username': self.username,
                  'password': self.password
              },
              verify=self.verify_ssl
          )
          j = r.json()
          logger.debug('Request response:')
          logger.debug(pformat(vars(r)))
          logger.debug('JSON:')
          logger.debug(pformat(j))
          if 'token' not in j:
              raise OpsviewLoginException("Failed to retrieve token. "
                                          "Please check your credentials")
          self.headers['X-Opsview-Token'] = j['token']
          self._token_age = datetime.datetime.now()
          return j['token'f login(self, verbose=False):
          '''
          Authenticate with Opsview
          :param verbose: Verbose output mode
          :type verbose: bool
          :return: The authentification token
          :rtype: str or unicode
          '''
          url = '{}/{}'.format(self.rest_url, 'login')
          logger.debug('POST: {}'.format(url))
          r = requests.post(url, json={
                  'username': self.username,
                  'password': self.password
              },
              verify=self.verify_ssl
          )
          j = r.json()
          logger.debug('Request response:')
          logger.debug(pformat(vars(r)))
          logger.debug('JSON:')
          logger.debug(pformat(j))
          if 'token' not in j:
              raise OpsviewLoginException("Failed to retrieve token. "
                                          "Please check your credentials")
          self.headers['X-Opsview-Token'] = j['token']
          self._token_age = datetime.datetime.now()
          return j['token']
docs: Authenticate with Opsview
          :param verbose: Verbose output mode
          :type verbose: bool
          :return: The authentification token
          :rtype: str or unicode