I'm very new to python. The job assigned to me was to perform a put and get operation on one of the products web ui using python. I tried with the following code,
import urllib2
import ssl
try:
response = urllib2.urlopen('https://the product web ui address')
print 'response headers: "%s"' % response.info() except IOError, e:
if hasattr(e, 'code'): # HTTPError
print 'http error code: ', e.code
elif hasattr(e, 'reason'): # URLError
print "can't connect, reason: ", e.reason
else:
raise
This is raising an error:
can't connect, reason: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
The url, while accessing through browser will show that it is having a certificate error. We need to click on proceed to go to the url. Can somebody help me with a way to perform put and get operation on such a uri. Sorry if this question seems dumb, thanks for the support.
Also, i tried with requests. Attaching the code. It also gives the same error
import requests
import sys
try:
r = requests.get("https://the product web ui address")
data = r.content
print r.status_code
print data
except:
print "Error Occured ",sys.exc_info()[0]
The error is :
Error Occured class 'requests.exceptions.SSLError'