本文整理汇总了Python中influxdb.InfluxDBClusterClient.from_DSN方法的典型用法代码示例。如果您正苦于以下问题:Python InfluxDBClusterClient.from_DSN方法的具体用法?Python InfluxDBClusterClient.from_DSN怎么用?Python InfluxDBClusterClient.from_DSN使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类influxdb.InfluxDBClusterClient
的用法示例。
在下文中一共展示了InfluxDBClusterClient.from_DSN方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dsn_mixed_scheme_case
# 需要导入模块: from influxdb import InfluxDBClusterClient [as 别名]
# 或者: from influxdb.InfluxDBClusterClient import from_DSN [as 别名]
def test_dsn_mixed_scheme_case(self):
cli = InfluxDBClusterClient.from_DSN("hTTps+inFLUxdb://usr:[email protected]:8086/db")
self.assertEqual("pWd", cli._client._password)
self.assertEqual("https://host:8086", cli._client._baseurl)
cli = InfluxDBClusterClient.from_DSN("uDP+influxdb://usr:[email protected]:8086,usr:[email protected]:8086/db")
self.assertTrue(cli._client.use_udp)
示例2: test_dsn
# 需要导入模块: from influxdb import InfluxDBClusterClient [as 别名]
# 或者: from influxdb.InfluxDBClusterClient import from_DSN [as 别名]
def test_dsn(self):
cli = InfluxDBClusterClient.from_DSN(self.dsn_string)
self.assertEqual(2, len(cli.clients))
self.assertEqual('http://host1:8086', cli.clients[0]._baseurl)
self.assertEqual('uSr', cli.clients[0]._username)
self.assertEqual('pWd', cli.clients[0]._password)
self.assertEqual('db', cli.clients[0]._database)
self.assertFalse(cli.clients[0].use_udp)
self.assertEqual('http://host2:8086', cli.clients[1]._baseurl)
self.assertEqual('uSr', cli.clients[1]._username)
self.assertEqual('pWd', cli.clients[1]._password)
self.assertEqual('db', cli.clients[1]._database)
self.assertFalse(cli.clients[1].use_udp)
cli = InfluxDBClusterClient.from_DSN('udp+' + self.dsn_string)
self.assertTrue(cli.clients[0].use_udp)
self.assertTrue(cli.clients[1].use_udp)
cli = InfluxDBClusterClient.from_DSN('https+' + self.dsn_string)
self.assertEqual('https://host1:8086', cli.clients[0]._baseurl)
self.assertEqual('https://host2:8086', cli.clients[1]._baseurl)
cli = InfluxDBClusterClient.from_DSN('https+' + self.dsn_string,
**{'ssl': False})
self.assertEqual('http://host1:8086', cli.clients[0]._baseurl)
self.assertEqual('http://host2:8086', cli.clients[1]._baseurl)
示例3: test_dsn
# 需要导入模块: from influxdb import InfluxDBClusterClient [as 别名]
# 或者: from influxdb.InfluxDBClusterClient import from_DSN [as 别名]
def test_dsn(self):
cli = InfluxDBClusterClient.from_DSN(
'influxdb://usr:[email protected]:8086,usr:[email protected]:8086/db')
self.assertEqual(2, len(cli.clients))
self.assertEqual('http://host1:8086', cli.clients[0]._baseurl)
self.assertEqual('usr', cli.clients[0]._username)
self.assertEqual('pwd', cli.clients[0]._password)
self.assertEqual('db', cli.clients[0]._database)
self.assertFalse(cli.clients[0].use_udp)
self.assertEqual('http://host2:8086', cli.clients[1]._baseurl)
self.assertEqual('usr', cli.clients[1]._username)
self.assertEqual('pwd', cli.clients[1]._password)
self.assertEqual('db', cli.clients[1]._database)
self.assertFalse(cli.clients[1].use_udp)
cli = InfluxDBClusterClient.from_DSN(
'udp+influxdb://usr:[email protected]:8086,usr:[email protected]:8086/db')
self.assertTrue(cli.clients[0].use_udp)
self.assertTrue(cli.clients[1].use_udp)
cli = InfluxDBClusterClient.from_DSN(
'https+influxdb://usr:[email protected]:8086,usr:[email protected]:8086/db')
self.assertEqual('https://host1:8086', cli.clients[0]._baseurl)
self.assertEqual('https://host2:8086', cli.clients[1]._baseurl)
cli = InfluxDBClusterClient.from_DSN(
'https+influxdb://usr:[email protected]:8086,usr:[email protected]:8086/db',
**{'ssl': False})
self.assertEqual('http://host1:8086', cli.clients[0]._baseurl)
self.assertEqual('http://host2:8086', cli.clients[1]._baseurl)
示例4: test_dsn
# 需要导入模块: from influxdb import InfluxDBClusterClient [as 别名]
# 或者: from influxdb.InfluxDBClusterClient import from_DSN [as 别名]
def test_dsn(self):
cli = InfluxDBClusterClient.from_DSN(self.dsn_string)
self.assertEqual(2, len(cli.clients))
self.assertEqual("http://host1:8086", cli.clients[0]._baseurl)
self.assertEqual("uSr", cli.clients[0]._username)
self.assertEqual("pWd", cli.clients[0]._password)
self.assertEqual("db", cli.clients[0]._database)
self.assertFalse(cli.clients[0].use_udp)
self.assertEqual("http://host2:8086", cli.clients[1]._baseurl)
self.assertEqual("uSr", cli.clients[1]._username)
self.assertEqual("pWd", cli.clients[1]._password)
self.assertEqual("db", cli.clients[1]._database)
self.assertFalse(cli.clients[1].use_udp)
cli = InfluxDBClusterClient.from_DSN("udp+" + self.dsn_string)
self.assertTrue(cli.clients[0].use_udp)
self.assertTrue(cli.clients[1].use_udp)
cli = InfluxDBClusterClient.from_DSN("https+" + self.dsn_string)
self.assertEqual("https://host1:8086", cli.clients[0]._baseurl)
self.assertEqual("https://host2:8086", cli.clients[1]._baseurl)
cli = InfluxDBClusterClient.from_DSN("https+" + self.dsn_string, **{"ssl": False})
self.assertEqual("http://host1:8086", cli.clients[0]._baseurl)
self.assertEqual("http://host2:8086", cli.clients[1]._baseurl)
示例5: test_dsn_mixed_scheme_case
# 需要导入模块: from influxdb import InfluxDBClusterClient [as 别名]
# 或者: from influxdb.InfluxDBClusterClient import from_DSN [as 别名]
def test_dsn_mixed_scheme_case(self):
cli = InfluxDBClusterClient.from_DSN(
'hTTps+inFLUxdb://usr:[email protected]:8086/db')
self.assertEqual('pWd', cli.clients[0]._password)
self.assertEqual('https://host:8086', cli.clients[0]._baseurl)
cli = InfluxDBClusterClient.from_DSN(
'uDP+influxdb://usr:[email protected]:8086,usr:[email protected]:8086/db')
self.assertTrue(cli.clients[0].use_udp)
示例6: test_dsn_single_client
# 需要导入模块: from influxdb import InfluxDBClusterClient [as 别名]
# 或者: from influxdb.InfluxDBClusterClient import from_DSN [as 别名]
def test_dsn_single_client(self):
cli = InfluxDBClusterClient.from_DSN("influxdb://usr:[email protected]:8086/db")
self.assertEqual("http://host:8086", cli.clients[0]._baseurl)
self.assertEqual("usr", cli.clients[0]._username)
self.assertEqual("pwd", cli.clients[0]._password)
self.assertEqual("db", cli.clients[0]._database)
self.assertFalse(cli.clients[0].use_udp)
cli = InfluxDBClusterClient.from_DSN("udp+influxdb://usr:[email protected]:8086/db")
self.assertTrue(cli.clients[0].use_udp)
cli = InfluxDBClusterClient.from_DSN("https+influxdb://usr:[email protected]:8086/db")
self.assertEqual("https://host:8086", cli.clients[0]._baseurl)
cli = InfluxDBClusterClient.from_DSN("https+influxdb://usr:[email protected]:8086/db", **{"ssl": False})
self.assertEqual("http://host:8086", cli.clients[0]._baseurl)
示例7: test_dsn
# 需要导入模块: from influxdb import InfluxDBClusterClient [as 别名]
# 或者: from influxdb.InfluxDBClusterClient import from_DSN [as 别名]
def test_dsn(self):
cli = InfluxDBClusterClient.from_DSN(self.dsn_string)
self.assertEqual([("host1", 8086), ("host2", 8086)], cli.hosts)
self.assertEqual("http://host1:8086", cli._client._baseurl)
self.assertEqual("uSr", cli._client._username)
self.assertEqual("pWd", cli._client._password)
self.assertEqual("db", cli._client._database)
self.assertFalse(cli._client.use_udp)
cli = InfluxDBClusterClient.from_DSN("udp+" + self.dsn_string)
self.assertTrue(cli._client.use_udp)
cli = InfluxDBClusterClient.from_DSN("https+" + self.dsn_string)
self.assertEqual("https://host1:8086", cli._client._baseurl)
cli = InfluxDBClusterClient.from_DSN("https+" + self.dsn_string, **{"ssl": False})
self.assertEqual("http://host1:8086", cli._client._baseurl)
示例8: create_cluster
# 需要导入模块: from influxdb import InfluxDBClusterClient [as 别名]
# 或者: from influxdb.InfluxDBClusterClient import from_DSN [as 别名]
def create_cluster(self):
logging.info("connecting to influxdb at :%s",self.hosts)
self.client = InfluxDBClusterClient.from_DSN(self.hosts,
ssl= self.use_ssl,
verify_ssl=self.verify_ssl,
timeout=self.timeout,
use_udp=self.use_udp)
return self.client
示例9: test_dsn
# 需要导入模块: from influxdb import InfluxDBClusterClient [as 别名]
# 或者: from influxdb.InfluxDBClusterClient import from_DSN [as 别名]
def test_dsn(self):
cli = InfluxDBClusterClient.from_DSN(self.dsn_string)
self.assertEqual([('host1', 8086), ('host2', 8086)], cli.hosts)
self.assertEqual('http://host1:8086', cli._client._baseurl)
self.assertEqual('uSr', cli._client._username)
self.assertEqual('pWd', cli._client._password)
self.assertEqual('db', cli._client._database)
self.assertFalse(cli._client.use_udp)
cli = InfluxDBClusterClient.from_DSN('udp+' + self.dsn_string)
self.assertTrue(cli._client.use_udp)
cli = InfluxDBClusterClient.from_DSN('https+' + self.dsn_string)
self.assertEqual('https://host1:8086', cli._client._baseurl)
cli = InfluxDBClusterClient.from_DSN('https+' + self.dsn_string,
**{'ssl': False})
self.assertEqual('http://host1:8086', cli._client._baseurl)
示例10: run_query
# 需要导入模块: from influxdb import InfluxDBClusterClient [as 别名]
# 或者: from influxdb.InfluxDBClusterClient import from_DSN [as 别名]
def run_query(self, query):
client = InfluxDBClusterClient.from_DSN(self.configuration['url'])
logger.debug("influxdb url: %s", self.configuration['url'])
logger.debug("influxdb got query: %s", query)
try:
results = client.query(query)
if not isinstance(results, list):
results = [results]
json_data = _transform_result(results)
error = None
except Exception, ex:
json_data = None
error = ex.message
示例11: test_dsn_password_caps
# 需要导入模块: from influxdb import InfluxDBClusterClient [as 别名]
# 或者: from influxdb.InfluxDBClusterClient import from_DSN [as 别名]
def test_dsn_password_caps(self):
cli = InfluxDBClusterClient.from_DSN(
'https+influxdb://usr:[email protected]:8086/db')
self.assertEqual('pWd', cli._client._password)
示例12: test_dsn_password_caps
# 需要导入模块: from influxdb import InfluxDBClusterClient [as 别名]
# 或者: from influxdb.InfluxDBClusterClient import from_DSN [as 别名]
def test_dsn_password_caps(self):
cli = InfluxDBClusterClient.from_DSN("https+influxdb://usr:[email protected]:8086/db")
self.assertEqual("pWd", cli.clients[0]._password)