This looks like hosts entry missing. But since it seems to work in curl, I'm clueless. :/
On Fri, Feb 23, 2018 at 3:59 PM, Karthikeyan S <[email protected]> wrote: > Changing it to sessions resulted in the error below > > (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection > object at 0x106278610>: Failed to establish a new connection: [Errno 8] > nodename nor servname provided, or not known',)) > > On Fri, Feb 23, 2018 at 3:55 PM, Karthikeyan S <[email protected]> > wrote: > >> I saw this sort of code with session in the stackoverflow and I tried it >> before posting it in the forum.. The error remains the same. >> >> On Fri, Feb 23, 2018 at 3:52 PM, Bharathwaaj S <[email protected]> >> wrote: >> >>> Try using session. >>> >>> import requests,time,json >>> >>> session = requests.Session() >>> adapter = requests.adapters.HTTPAdapter(max_retries = 5) >>> session.mount('http://', adapter) >>> >>> 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 = *session*.post(url , params=params, verify=False) >>> print(r.status_code) >>> print(r.text) >>> #time.sleep(45) >>> fobj.close() >>> >>> >>> >>> On Fri, Feb 23, 2018 at 3:37 PM, Karthikeyan S <[email protected]> >>> wrote: >>> >>>> Yes, via CURL command it works perfectly. >>>> >>>> On Fri, Feb 23, 2018 at 3:13 PM, Shrayas rajagopal <[email protected]> >>>> wrote: >>>> >>>>> Hi Karthikeyan, >>>>> >>>>> On Fri, Feb 23, 2018 at 3:02 PM, Karthikeyan S <[email protected]> >>>>> wrote: >>>>> >>>>> [...] >>>>> >>>>> > Could you please help ? >>>>> >>>>> Are you able to execute the same thing outside of python? i.e. with >>>>> another RESTful client like postman? >>>>> >>>>> Regards, >>>>> Shrayas >>>>> _______________________________________________ >>>>> Chennaipy mailing list >>>>> [email protected] >>>>> https://mail.python.org/mailman/listinfo/chennaipy >>>>> >>>> >>>> >>>> _______________________________________________ >>>> Chennaipy mailing list >>>> [email protected] >>>> https://mail.python.org/mailman/listinfo/chennaipy >>>> >>>> >>> >>> _______________________________________________ >>> Chennaipy mailing list >>> [email protected] >>> https://mail.python.org/mailman/listinfo/chennaipy >>> >>> >> > > _______________________________________________ > Chennaipy mailing list > [email protected] > https://mail.python.org/mailman/listinfo/chennaipy > >
_______________________________________________ Chennaipy mailing list [email protected] https://mail.python.org/mailman/listinfo/chennaipy
