def __init__(self, id): self.id = id cfg = self.__cfg() self.host = nvl(cfg.main.host, 'localhost') self.port = int(nvl(cfg.main.port, 443)) self.auth = self.__auth(cfg) self.root = nvl(cfg.main.root)
def __auth(self, cfg): auth = nvl(cfg.main.auth) if not auth: return NoAuth() if auth == 'basic': basic = cfg.basic return Basic(basic.user, basic.password)
def __init(cls, url): b = Broker(url) b.cacert = nvl(cfg.broker.cacert) b.clientcert = nvl(cfg.broker.clientcert)