1

私のコードは以下のとおりです

from jenkinsapi.jenkins import Jenkins

def get_server_instance():
    jenkins_url = 'https://<privateJenkinsServer>:<port>'
    print "Hello" 
   server = Jenkins(jenkins_url, username = 'foouser', password = 'foopassword')
    return server

if __name__ == '__main__':
    print get_server_instance().version

これを実行すると、 「Hello」と表示されてハングします。この理由は何ですか?

NB プロキシの背後にある企業ネットワークでこれを実行しています。

参照: http://pythonhosted.org/jenkinsapi/using_jenkinsapi.html#example-1-get-version-of-jenkins

コマンドを強制終了すると、次のエラーが発生します。

File "C:\Python27\lib\ssl.py", line 643, in read
    v = self._sslobj.read(len)

完全なログ。

>>> execfile('C:\Users\idatta\Project\Python\Demo\JenkinsAPI_v1.py')
started
https://jenkm1.discoverfinancial.com:8443

Traceback (most recent call last):
  File "<pyshell#20>", line 1, in <module>
    execfile('C:\Users\idatta\Project\Python\Demo\JenkinsAPI_v1.py')
  File "C:\Users\idatta\Project\Python\Demo\JenkinsAPI_v1.py", line 28, in <module>
    print get_server_instance().version
  File "C:\Users\idatta\Project\Python\Demo\JenkinsAPI_v1.py", line 19, in get_server_instance
    server = Jenkins(jenkins_url, username = 'idatta', password = 'Gr33nCard_1', ssl_verify=False)
  File "C:\Python27\lib\site-packages\jenkinsapi\jenkins.py", line 59, in __init__
    JenkinsBase.__init__(self, baseurl, poll=not lazy)
  File "C:\Python27\lib\site-packages\jenkinsapi\jenkinsbase.py", line 35, in __init__
    self.poll()
  File "C:\Python27\lib\site-packages\jenkinsapi\jenkinsbase.py", line 61, in poll
    data['jobs'] = self.resolve_job_folders(data['jobs'])
  File "C:\Python27\lib\site-packages\jenkinsapi\jenkinsbase.py", line 100, in resolve_job_folders
    jobs += self.process_job_folder(job, self.baseurl)
  File "C:\Python27\lib\site-packages\jenkinsapi\jenkinsbase.py", line 112, in process_job_folder
    result += self.process_job_folder(job, folder_path)
  File "C:\Python27\lib\site-packages\jenkinsapi\jenkinsbase.py", line 112, in process_job_folder
    result += self.process_job_folder(job, folder_path)
  File "C:\Python27\lib\site-packages\jenkinsapi\jenkinsbase.py", line 107, in process_job_folder
    tree='jobs[name,color]')
  File "C:\Python27\lib\site-packages\jenkinsapi\jenkinsbase.py", line 79, in get_data
    response = requester.get_url(url, params)
  File "C:\Python27\lib\site-packages\jenkinsapi\utils\requester.py", line 109, in get_url
    return requests.get(self._update_url_scheme(url), **requestKwargs)
  File "C:\Python27\lib\site-packages\requests\api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Python27\lib\site-packages\requests\api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Python27\lib\site-packages\requests\sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Python27\lib\site-packages\requests\sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python27\lib\site-packages\requests\adapters.py", line 423, in send
    timeout=timeout
  File "C:\Python27\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "C:\Python27\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 384, in _make_request
    httplib_response = conn.getresponse(buffering=True)
  File "C:\Python27\lib\httplib.py", line 1136, in getresponse
    response.begin()
  File "C:\Python27\lib\httplib.py", line 453, in begin
    version, status, reason = self._read_status()
  File "C:\Python27\lib\httplib.py", line 409, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "C:\Python27\lib\socket.py", line 480, in readline
    data = self._sock.recv(self._rbufsize)
  File "C:\Python27\lib\ssl.py", line 756, in recv
    return self.read(buflen)
  File "C:\Python27\lib\ssl.py", line 643, in read
    v = self._sslobj.read(len)
KeyboardInterrupt
>>> 
4

1 に答える 1