[Chennaipy] Require help in code
Karthikeyan S
karthik120 at gmail.com
Fri Feb 23 04:32:43 EST 2018
Hi Python group,
I wrote a code to execute list of jenkins job by reading a text file. So
far, it's able to read the text file and get the jobs one by one. Only
problem is with the requests command
Please see the sample code below
#!/usr/bin/env python
import requests,time,json
fobj = open("file")
for x in fobj:
x = x.replace("\n", "")
url="https://username:password@localhost
/jenkins/job/job-name/buildWithParameters"
params = {'BRANCH':x}
headers = {"Content-Type": "application/xml"}
r = request.post(url , params=params, verify=False)
print(r.status_code)
print(r.text)
#time.sleep(45)
fobj.close()
Error
------
Traceback (most recent call last):
File "./delete_build_job_exeuction.py", line 12, in <module>
r = sess.post(url , params=params, verify=False)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py",
line 555, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py",
line 508, in request
resp = self.send(prep, **send_kwargs)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py",
line 618, in send
r = adapter.send(request, **kwargs)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/adapters.py",
line 506, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='localhost',
port=443): Max retries exceeded with url:
/jenkins/job/job--name/buildWithParameter/buildWithParameters?BRANCH=super
(Caused by SSLError(SSLEOFError(8, u'EOF occurred in violation of protocol
(_ssl.c:590)'),))
Could you please help ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chennaipy/attachments/20180223/9bd3321c/attachment.html>
More information about the Chennaipy
mailing list