<div dir="ltr"><div><div><div>Hi Karthikeyan,  <br><br></div>There could be some SSL certificate handling  issue from within python. <br><br></div>Please see  if it works for you after adding the follow code snippet to your code.<br><br>try:<br>    import _ssl<br>    _ssl.PROTOCOL_SSLv23 = _ssl.PROTOCOL_TLSv1<br>except:<br>    traceback.print_exc()<br>    pass<br> <br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 23 February 2018 at 15:59,  <span dir="ltr"><<a href="mailto:chennaipy-request@python.org" target="_blank">chennaipy-request@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send Chennaipy mailing list submissions to<br>
        <a href="mailto:chennaipy@python.org">chennaipy@python.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://mail.python.org/mailman/listinfo/chennaipy" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/chennaipy</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:chennaipy-request@python.org">chennaipy-request@python.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:chennaipy-owner@python.org">chennaipy-owner@python.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Chennaipy digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Re: Require help in code (Karthikeyan S)<br>
   2. Re: Require help in code (Karthikeyan S)<br>
<br>
<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
<br>
Message: 1<br>
Date: Fri, 23 Feb 2018 15:55:46 +0530<br>
From: Karthikeyan S <<a href="mailto:karthik120@gmail.com">karthik120@gmail.com</a>><br>
To: Chennai Python User Group Mailing List <<a href="mailto:chennaipy@python.org">chennaipy@python.org</a>><br>
Subject: Re: [Chennaipy] Require help in code<br>
Message-ID:<br>
        <<a href="mailto:CAFPraRy0zAJMLeSe1FydX6qXkNTra-a23YA%2BeoaCRYDha%2BvfSg@mail.gmail.com">CAFPraRy0zAJMLeSe1FydX6qXkNTr<wbr>a-a23YA+eoaCRYDha+vfSg@mail.<wbr>gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
I saw this sort of code with session in the stackoverflow and I tried it<br>
before posting it in the forum.. The error remains the same.<br>
<br>
On Fri, Feb 23, 2018 at 3:52 PM, Bharathwaaj S <<a href="mailto:bharath@testpress.in">bharath@testpress.in</a>> wrote:<br>
<br>
> Try using session.<br>
><br>
> import requests,time,json<br>
><br>
> session = requests.Session()<br>
> adapter = requests.adapters.HTTPAdapter(<wbr>max_retries = 5)<br>
> session.mount('http://', adapter)<br>
><br>
> fobj = open("file")<br>
> for x in fobj:<br>
>        x = x.replace("\n", "")<br>
>        url="<a href="https://username">https://username</a>:<wbr>password@localhost/jenkins/<wbr>job/job-name/<br>
> buildWithParameters"<br>
>        params = {'BRANCH':x}<br>
>        headers = {"Content-Type": "application/xml"}<br>
>        r = *session*.post(url , params=params, verify=False)<br>
>        print(r.status_code)<br>
>        print(r.text)<br>
>        #time.sleep(45)<br>
> fobj.close()<br>
><br>
><br>
><br>
> On Fri, Feb 23, 2018 at 3:37 PM, Karthikeyan S <<a href="mailto:karthik120@gmail.com">karthik120@gmail.com</a>><br>
> wrote:<br>
><br>
>> Yes, via CURL command it works perfectly.<br>
>><br>
>> On Fri, Feb 23, 2018 at 3:13 PM, Shrayas rajagopal <<a href="mailto:shrayasr@gmail.com">shrayasr@gmail.com</a>><br>
>> wrote:<br>
>><br>
>>> Hi Karthikeyan,<br>
>>><br>
>>> On Fri, Feb 23, 2018 at 3:02 PM, Karthikeyan S <<a href="mailto:karthik120@gmail.com">karthik120@gmail.com</a>><br>
>>> wrote:<br>
>>><br>
>>> [...]<br>
>>><br>
>>> > Could you please help ?<br>
>>><br>
>>> Are you able to execute the same thing outside of python? i.e. with<br>
>>> another RESTful client like postman?<br>
>>><br>
>>> Regards,<br>
>>> Shrayas<br>
>>> ______________________________<wbr>_________________<br>
>>> Chennaipy mailing list<br>
>>> <a href="mailto:Chennaipy@python.org">Chennaipy@python.org</a><br>
>>> <a href="https://mail.python.org/mailman/listinfo/chennaipy" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/chennaipy</a><br>
>>><br>
>><br>
>><br>
>> ______________________________<wbr>_________________<br>
>> Chennaipy mailing list<br>
>> <a href="mailto:Chennaipy@python.org">Chennaipy@python.org</a><br>
>> <a href="https://mail.python.org/mailman/listinfo/chennaipy" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/chennaipy</a><br>
>><br>
>><br>
><br>
> ______________________________<wbr>_________________<br>
> Chennaipy mailing list<br>
> <a href="mailto:Chennaipy@python.org">Chennaipy@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/chennaipy" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/chennaipy</a><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mail.python.org/pipermail/chennaipy/attachments/20180223/b59479bf/attachment-0001.html" rel="noreferrer" target="_blank">http://mail.python.org/<wbr>pipermail/chennaipy/<wbr>attachments/20180223/b59479bf/<wbr>attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Fri, 23 Feb 2018 15:59:01 +0530<br>
From: Karthikeyan S <<a href="mailto:karthik120@gmail.com">karthik120@gmail.com</a>><br>
To: Chennai Python User Group Mailing List <<a href="mailto:chennaipy@python.org">chennaipy@python.org</a>><br>
Subject: Re: [Chennaipy] Require help in code<br>
Message-ID:<br>
        <CAFPraRzOD+<wbr>M0cQpoTnCNojDiuswm2QZ_-FDy=<a href="mailto:Xss4bANohKwvw@mail.gmail.com">Xss<wbr>4bANohKwvw@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Changing it to sessions resulted in the error below<br>
<br>
(Caused by NewConnectionError('<urllib3.<wbr>connection.<wbr>VerifiedHTTPSConnection<br>
object at 0x106278610>: Failed to establish a new connection: [Errno 8]<br>
nodename nor servname provided, or not known',))<br>
<br>
On Fri, Feb 23, 2018 at 3:55 PM, Karthikeyan S <<a href="mailto:karthik120@gmail.com">karthik120@gmail.com</a>> wrote:<br>
<br>
> I saw this sort of code with session in the stackoverflow and I tried it<br>
> before posting it in the forum.. The error remains the same.<br>
><br>
> On Fri, Feb 23, 2018 at 3:52 PM, Bharathwaaj S <<a href="mailto:bharath@testpress.in">bharath@testpress.in</a>><br>
> wrote:<br>
><br>
>> Try using session.<br>
>><br>
>> import requests,time,json<br>
>><br>
>> session = requests.Session()<br>
>> adapter = requests.adapters.HTTPAdapter(<wbr>max_retries = 5)<br>
>> session.mount('http://', adapter)<br>
>><br>
>> fobj = open("file")<br>
>> for x in fobj:<br>
>>        x = x.replace("\n", "")<br>
>>        url="<a href="https://username">https://username</a>:<wbr>password@localhost/jenkins/<wbr>job/job-name/<br>
>> buildWithParameters"<br>
>>        params = {'BRANCH':x}<br>
>>        headers = {"Content-Type": "application/xml"}<br>
>>        r = *session*.post(url , params=params, verify=False)<br>
>>        print(r.status_code)<br>
>>        print(r.text)<br>
>>        #time.sleep(45)<br>
>> fobj.close()<br>
>><br>
>><br>
>><br>
>> On Fri, Feb 23, 2018 at 3:37 PM, Karthikeyan S <<a href="mailto:karthik120@gmail.com">karthik120@gmail.com</a>><br>
>> wrote:<br>
>><br>
>>> Yes, via CURL command it works perfectly.<br>
>>><br>
>>> On Fri, Feb 23, 2018 at 3:13 PM, Shrayas rajagopal <<a href="mailto:shrayasr@gmail.com">shrayasr@gmail.com</a>><br>
>>> wrote:<br>
>>><br>
>>>> Hi Karthikeyan,<br>
>>>><br>
>>>> On Fri, Feb 23, 2018 at 3:02 PM, Karthikeyan S <<a href="mailto:karthik120@gmail.com">karthik120@gmail.com</a>><br>
>>>> wrote:<br>
>>>><br>
>>>> [...]<br>
>>>><br>
>>>> > Could you please help ?<br>
>>>><br>
>>>> Are you able to execute the same thing outside of python? i.e. with<br>
>>>> another RESTful client like postman?<br>
>>>><br>
>>>> Regards,<br>
>>>> Shrayas<br>
>>>> ______________________________<wbr>_________________<br>
>>>> Chennaipy mailing list<br>
>>>> <a href="mailto:Chennaipy@python.org">Chennaipy@python.org</a><br>
>>>> <a href="https://mail.python.org/mailman/listinfo/chennaipy" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/chennaipy</a><br>
>>>><br>
>>><br>
>>><br>
>>> ______________________________<wbr>_________________<br>
>>> Chennaipy mailing list<br>
>>> <a href="mailto:Chennaipy@python.org">Chennaipy@python.org</a><br>
>>> <a href="https://mail.python.org/mailman/listinfo/chennaipy" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/chennaipy</a><br>
>>><br>
>>><br>
>><br>
>> ______________________________<wbr>_________________<br>
>> Chennaipy mailing list<br>
>> <a href="mailto:Chennaipy@python.org">Chennaipy@python.org</a><br>
>> <a href="https://mail.python.org/mailman/listinfo/chennaipy" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/chennaipy</a><br>
>><br>
>><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mail.python.org/pipermail/chennaipy/attachments/20180223/3a78e13b/attachment.html" rel="noreferrer" target="_blank">http://mail.python.org/<wbr>pipermail/chennaipy/<wbr>attachments/20180223/3a78e13b/<wbr>attachment.html</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
______________________________<wbr>_________________<br>
Chennaipy mailing list<br>
<a href="mailto:Chennaipy@python.org">Chennaipy@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/chennaipy" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/chennaipy</a><br>
<br>
<br>
------------------------------<br>
<br>
End of Chennaipy Digest, Vol 54, Issue 16<br>
******************************<wbr>***********<br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Thanks,<br><i>S. S. Venkata Raman</i>.<br></div>
</div>