当前位置: 首页>>代码示例>>Python>>正文


Python InfluxDBClusterClient.from_DSN方法代码示例

本文整理汇总了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)
开发者ID:a-sk,项目名称:influxdb-python,代码行数:9,代码来源:client_test.py

示例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)
开发者ID:arnimarj,项目名称:influxdb-python,代码行数:28,代码来源:client_test.py

示例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)
开发者ID:kespindler,项目名称:influxdb-python,代码行数:32,代码来源:client_test.py

示例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)
开发者ID:krishnazure,项目名称:influxdb-python,代码行数:27,代码来源:client_test.py

示例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)
开发者ID:arnimarj,项目名称:influxdb-python,代码行数:11,代码来源:client_test.py

示例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)
开发者ID:krishnazure,项目名称:influxdb-python,代码行数:18,代码来源:client_test.py

示例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)
开发者ID:a-sk,项目名称:influxdb-python,代码行数:19,代码来源:client_test.py

示例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
开发者ID:jiutianfeiwu,项目名称:kafka-influxdb,代码行数:10,代码来源:influxdb_writer.py

示例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)
开发者ID:simudream,项目名称:influxdb-python,代码行数:20,代码来源:client_test.py

示例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
开发者ID:abudulemusa,项目名称:redash,代码行数:18,代码来源:influx_db.py

示例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)
开发者ID:simudream,项目名称:influxdb-python,代码行数:6,代码来源:client_test.py

示例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)
开发者ID:krishnazure,项目名称:influxdb-python,代码行数:5,代码来源:client_test.py


注:本文中的influxdb.InfluxDBClusterClient.from_DSN方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。