CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes
das_client.HTTPSClientAuthHandler Class Reference
Inheritance diagram for das_client.HTTPSClientAuthHandler:

Public Member Functions

def __init__ (self, key=None, cert=None, capath=None, level=0)
 
def get_connection (self, host, timeout=300)
 
def https_open (self, req)
 

Public Attributes

 cert
 
 key
 

Static Public Attributes

 capath
 

Detailed Description

Simple HTTPS client authentication class based on provided
key/ca information

Definition at line 52 of file das_client.py.

Constructor & Destructor Documentation

◆ __init__()

def das_client.HTTPSClientAuthHandler.__init__ (   self,
  key = None,
  cert = None,
  capath = None,
  level = 0 
)

Definition at line 57 of file das_client.py.

57  def __init__(self, key=None, cert=None, capath=None, level=0):
58  if level > 1:
59  urllib2.HTTPSHandler.__init__(self, debuglevel=1)
60  else:
61  urllib2.HTTPSHandler.__init__(self)
62  self.key = key
63  self.cert = cert

Member Function Documentation

◆ get_connection()

def das_client.HTTPSClientAuthHandler.get_connection (   self,
  host,
  timeout = 300 
)
Connection method

Definition at line 73 of file das_client.py.

73  def get_connection(self, host, timeout=300):
74  """Connection method"""
75  if self.key and self.cert and not self.capath:
76  return httplib.HTTPSConnection(host, key_file=self.key,
77  cert_file=self.cert)
78  elif self.cert and self.capath:
79  context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
80  context.load_verify_locations(capath=self.capath)
81  context.load_cert_chain(self.cert)
82  return httplib.HTTPSConnection(host, context=context)
83  return httplib.HTTPSConnection(host)
84 

References das_client.HTTPSClientAuthHandler.capath, das_client.HTTPSClientAuthHandler.cert, condex::ConfI.key, condex::ConfF.key, edm::helpers::KeyVal< K, V >.key, edm::helpers::Key< K >.key, edm::MapOfVectors< K, T >::Iter.key, das_client.HTTPSClientAuthHandler.key, and cond::AuthorizationData.key.

Referenced by das_client.HTTPSClientAuthHandler.https_open().

◆ https_open()

def das_client.HTTPSClientAuthHandler.https_open (   self,
  req 
)
Open request method

Definition at line 66 of file das_client.py.

66  def https_open(self, req):
67  """Open request method"""
68  #Rather than pass in a reference to a connection class, we pass in
69  # a reference to a function which, for all intents and purposes,
70  # will behave as a constructor
71  return self.do_open(self.get_connection, req)
72 

References das_client.HTTPSClientAuthHandler.get_connection().

Member Data Documentation

◆ capath

das_client.HTTPSClientAuthHandler.capath
static

Definition at line 64 of file das_client.py.

Referenced by das_client.HTTPSClientAuthHandler.get_connection().

◆ cert

das_client.HTTPSClientAuthHandler.cert

◆ key

das_client.HTTPSClientAuthHandler.key