In my python script, i am trying to call my api as follows:
with requests.Session() as session:
url= 'https://example.com'
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
request_parameters = {'username': 'test', 'password':'pass'}
response = (session.post(auth_url, data=request_parameters, headers=headers))
I am getting the following exception:
File "C:\Users\Programs\Python\Python36\lib\site-packages\requests\sessions.py", line 518, in post return self.request('POST', url, data=data, json=json, **kwargs)
File "C:\Users\Programs\Python\Python36\lib\site-packages\requests\sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\Programs\Python\Python36\lib\site-packages\requests\sessions.py", line 585, in send
r = adapter.send(request, **kwargs)
File "C:\Users\Programs\Python\Python36\lib\site- packages\requests\adapters.py", line 477, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)
I want to call my service as https://example.com. It works for http:// connection but does not work for https://. What should i do for https connection? Also, when i call the service through Rest Client as https it works perfectly. Is there any other way to call the service as https connection?