← Back to team overview

python-jenkins-developers team mailing list archive

[Bug 1578626] Re: jenkins api error during get_version function call on Jenkins 2.1

 

def get_version(self):
        """Get the version of this Master.

        :returns: This master's version number ``str``

        Example::

            >>> info = server.get_version()
            >>> print info
            >>> 1.541

        """
        try:
            request = Request(self._build_url(''))
            request.add_header('X-Jenkins', '0.0')
# It's work when i add The following two lines into source.   
            if self.auth:
                request.add_header('Authorization', self.auth)
            response = urlopen(request, timeout=self.timeout)
            if response is None:
                raise EmptyResponseException(
                    "Error communicating with server[%s]: "
                    "empty response" % self.server)

            if six.PY2:
                return response.info().getheader('X-Jenkins')

            if six.PY3:
                return response.getheader('X-Jenkins')

        except (HTTPError, BadStatusLine):
            raise BadHTTPException("Error communicating with server[%s]"
                                   % self.server)

-- 
You received this bug notification because you are a member of Python
Jenkins Developers, which is subscribed to Python Jenkins.
https://bugs.launchpad.net/bugs/1578626

Title:
  jenkins api  error during get_version function call  on Jenkins 2.1

Status in Python Jenkins:
  New

Bug description:
  i have code which work on server version 1.XX I've upgraded Jenkins to
  2.1 version and now got error.

  string which return exception.

  server = jens.Jenkins(**jenkins_config)
  print("Connected to Jenkins version is: " + server.get_version())
  error is :
  Error communicating with server [..]

  Place in jenkins module where exception occurs:
  string number 498
   except (HTTPError, BadStatusLine):
              raise BadHTTPException("Error communicating with server[%s]"
                                     % self.server)

To manage notifications about this bug go to:
https://bugs.launchpad.net/python-jenkins/+bug/1578626/+subscriptions


References