@@ -115,14 +115,16 @@ def from_DSN(dsn, **kwargs):
115
115
116
116
:Example:
117
117
118
- >>> cli = InfluxDBClient.from_DSN('influxdb://username:password@\
118
+ ::
119
+
120
+ >> cli = InfluxDBClient.from_DSN('influxdb://username:password@\
119
121
localhost:8086/databasename', timeout=5)
120
- > >> type(cli)
121
- <class 'influxdb.client.InfluxDBClient'>
122
- > >> cli = InfluxDBClient.from_DSN('udp+influxdb://username:pass@\
122
+ >> type(cli)
123
+ <class 'influxdb.client.InfluxDBClient'>
124
+ >> cli = InfluxDBClient.from_DSN('udp+influxdb://username:pass@\
123
125
localhost:8086/databasename', timeout=5, udp_port=159)
124
- > >> print('{0._baseurl} - {0.use_udp} {0.udp_port}'.format(cli))
125
- http://localhost:8086 - True 159
126
+ >> print('{0._baseurl} - {0.use_udp} {0.udp_port}'.format(cli))
127
+ http://localhost:8086 - True 159
126
128
127
129
.. note:: parameters provided in `**kwargs` may override dsn parameters
128
130
.. note:: when using "udp+influxdb" the specified port (if any) will
@@ -431,9 +433,11 @@ def get_list_database(self):
431
433
432
434
:Example:
433
435
434
- >>> dbs = client.get_list_database()
435
- >>> dbs
436
- [{u'name': u'db1'}, {u'name': u'db2'}, {u'name': u'db3'}]
436
+ ::
437
+
438
+ >> dbs = client.get_list_database()
439
+ >> dbs
440
+ [{u'name': u'db1'}, {u'name': u'db2'}, {u'name': u'db3'}]
437
441
"""
438
442
return list (self .query ("SHOW DATABASES" ).get_points ())
439
443
@@ -532,13 +536,15 @@ def get_list_retention_policies(self, database=None):
532
536
533
537
:Example:
534
538
535
- >>> ret_policies = client.get_list_retention_policies('my_db')
536
- >>> ret_policies
537
- [{u'default': True,
538
- u'duration': u'0',
539
- u'name': u'default',
540
- u'replicaN': 1}]
541
- """
539
+ ::
540
+
541
+ >> ret_policies = client.get_list_retention_policies('my_db')
542
+ >> ret_policies
543
+ [{u'default': True,
544
+ u'duration': u'0',
545
+ u'name': u'default',
546
+ u'replicaN': 1}]
547
+ """
542
548
rsp = self .query (
543
549
"SHOW RETENTION POLICIES ON %s" % (database or self ._database )
544
550
)
@@ -555,8 +561,8 @@ def get_list_series(self, database=None):
555
561
556
562
:Example:
557
563
558
- >>> series = client.get_list_series('my_database')
559
- >>> series
564
+ >> series = client.get_list_series('my_database')
565
+ >> series
560
566
[{'name': u'cpu_usage',
561
567
'tags': [{u'_id': 1,
562
568
u'host': u'server01',
@@ -581,11 +587,13 @@ def get_list_users(self):
581
587
582
588
:Example:
583
589
584
- >>> users = client.get_list_users()
585
- >>> users
586
- [{u'admin': True, u'user': u'user1'},
587
- {u'admin': False, u'user': u'user2'},
588
- {u'admin': False, u'user': u'user3'}]
590
+ ::
591
+
592
+ >> users = client.get_list_users()
593
+ >> users
594
+ [{u'admin': True, u'user': u'user1'},
595
+ {u'admin': False, u'user': u'user2'},
596
+ {u'admin': False, u'user': u'user3'}]
589
597
"""
590
598
return list (self .query ("SHOW USERS" ).get_points ())
591
599
@@ -768,13 +776,15 @@ def from_DSN(dsn, client_base_class=InfluxDBClient,
768
776
769
777
:Example:
770
778
771
- >>> cluster = InfluxDBClusterClient.from_DSN('influxdb://usr:pwd\
779
+ ::
780
+
781
+ >> cluster = InfluxDBClusterClient.from_DSN('influxdb://usr:pwd\
772
782
@host1:8086,usr:pwd@host2:8086/db_name', timeout=5)
773
- > >> type(cluster)
774
- <class 'influxdb.client.InfluxDBClusterClient'>
775
- > >> cluster.clients
776
- [<influxdb.client.InfluxDBClient at 0x7feb480295d0>,
777
- <influxdb.client.InfluxDBClient at 0x7feb438ec950>]
783
+ >> type(cluster)
784
+ <class 'influxdb.client.InfluxDBClusterClient'>
785
+ >> cluster.clients
786
+ [<influxdb.client.InfluxDBClient at 0x7feb480295d0>,
787
+ <influxdb.client.InfluxDBClient at 0x7feb438ec950>]
778
788
"""
779
789
conn_params = urlparse (dsn )
780
790
netlocs = conn_params .netloc .split (',' )
0 commit comments