Forked from
DM / dm-docs
261 commits behind, 442 commits ahead of the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
dmHttpsHandler.py 1.02 KiB
#!/usr/bin/env python
import urllib2
import ssl
from dm.common.client.dmHttpsConnection import DmHttpsConnection
class DmHttpsHandler(urllib2.HTTPSHandler):
def https_open(self, req):
return self.do_open(DmHttpsConnection,req)
#######################################################################
# Testing.
if __name__ == '__main__':
from dm.common.utility.configurationManager import ConfigurationManager
cm = ConfigurationManager.getInstance()
cm.setSslCaCertFile("/home/sveseli/Work/DM/etc/ssl/cacert.pem")
print "Installing opener"
opener = urllib2.build_opener(DmHttpsHandler)
urllib2.install_opener(opener)
url = "https://zagreb.svdev.net:10232/dm/directory/list?path=/tmp"
print "Opening URL: ", url
#context = ssl.create_default_context(cafile="/home/sveseli/Work/DM/etc/ssl/cacert.pem")
#ssl._create_default_https_context = ssl._create_unverified_context
#f = urllib2.urlopen(url, context=context)
f = urllib2.urlopen(url)
print f.code
print f.read()