Esempio n. 1
0
    def __init__(self, endpoint, credentials, tre_client_endpoint=None):
        self.credentials = credentials
        self.endpoint = endpoint
        self.tre_client_endpoint = tre_client_endpoint
        # install authenticated opener for all of the urllib2 calls
        auth_handler = urllib2.HTTPDigestAuthHandler()
        urllib2.HTTPPasswordMgrWithDefaultRealm()
        auth_handler.add_password(realm=None,
                                  uri=endpoint,
                                  user=credentials['user'],
                                  passwd=credentials['password'])
        # TODO: add required server-side and client-side certificate validation
        # for https connections
        opener = urllib2.build_opener(auth_handler, urllib2.HTTPSHandler(),
                                      CDMIErrorProcessor())
        urllib2.install_opener(opener)

        self.blob_proxy = BlobOperations(endpoint)
        self.container_proxy = ContainerOperations(endpoint)