def test_connection(self): kylin = create_engine(self.dsn) assert as_unicode(kylin.url) == self.dsn assert kylin.url.host == 'sandbox' assert kylin.url.username == 'ADMIN' assert kylin.url.password == 'KYLIN' kylin = create_engine(self.cn_dsn) assert as_unicode(kylin.url) == self.cn_dsn
def description(self): return tuple([ as_unicode(c['label']), c['columnTypeName'].lower(), c['displaySize'], None, c['precision'], c['scale'], c['isNullable'], ] for c in self._column_metas)
def test_connection(self): engine = create_engine(self.cn_dsn) assert as_unicode(engine.url) == self.cn_dsn engine = create_engine('kylin://aa@bb123:aa@[email protected]:1024/learn_kylin') assert engine.url.username == 'aa@bb123' assert engine.url.password == 'aa@bb123' assert engine.url.host == 'hello.world.com' assert engine.url.port == 1024 assert engine.url.database == 'learn_kylin'
def basic_auth_dump(self, username, password): _auth = as_unicode('{}:{}').format(username, password) _auth = base64.b64encode(_auth.encode('utf-8')).decode('ascii') return {'Authorization': 'Basic {}'.format(_auth)}
def basic_auth(self, headers): _headers = headers.copy() _auth = as_unicode('{}:{}').format(self.username, self.password) _auth = base64.b64encode(_auth.encode('utf-8')).decode('ascii') _headers.update({'Authorization': 'Basic {}'.format(_auth)}) return _headers