File tree 2 files changed +34
-2
lines changed 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -111,12 +111,28 @@ def __init__(self,
111
111
def from_DSN (dsn , ** kwargs ):
112
112
"""
113
113
Returns an instance of InfluxDBClient from the provided data source
114
- name.
114
+ name. Supported schemes are "influxdb", "https+influxdb",
115
+ "udp+influxdb". Parameters for the InfluxDBClient constructor may be
116
+ also be passed to this function.
117
+
118
+ Examples:
119
+ >>> cli = InfluxDBClient.from_DSN('influxdb://username:password@\
120
+ ... localhost:8086/databasename', timeout=5)
121
+ >>> type(cli)
122
+ <class 'influxdb.client.InfluxDBClient'>
123
+ >>> cli = InfluxDBClient.from_DSN('udp+influxdb://username:pass@\
124
+ ... localhost:8086/databasename', timeout=5, udp_port=159)
125
+ >>> print('{0._baseurl} - {0.use_udp} {0.udp_port}'.format(cli))
126
+ http://localhost:8086 - True 159
127
+
115
128
:param dsn: data source name
116
129
:type dsn: string
117
130
:param **kwargs: additional parameters for InfluxDBClient.
118
131
:type **kwargs: dict
119
132
:note: parameters provided in **kwargs may override dsn parameters.
133
+ :note: when using "udp+influxdb" the specified port (if any) will be
134
+ used for the TCP connection; specify the udp port with the additional
135
+ udp_port parameter (cf. examples).
120
136
:raise ValueError: if the provided DSN has any unexpected value.
121
137
"""
122
138
dsn = dsn .lower ()
Original file line number Diff line number Diff line change @@ -110,12 +110,28 @@ def __init__(self,
110
110
def from_DSN (dsn , ** kwargs ):
111
111
"""
112
112
Returns an instance of InfluxDBClient from the provided data source
113
- name.
113
+ name. Supported schemes are "influxdb", "https+influxdb",
114
+ "udp+influxdb". Parameters for the InfluxDBClient constructor may be
115
+ also be passed to this function.
116
+
117
+ Examples:
118
+ >>> cli = InfluxDBClient.from_DSN('influxdb://username:password@\
119
+ ... localhost:8086/databasename', timeout=5)
120
+ >>> type(cli)
121
+ <class 'influxdb.client.InfluxDBClient'>
122
+ >>> cli = InfluxDBClient.from_DSN('udp+influxdb://username:pass@\
123
+ ... 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
+
114
127
:param dsn: data source name
115
128
:type dsn: string
116
129
:param **kwargs: additional parameters for InfluxDBClient.
117
130
:type **kwargs: dict
118
131
:note: parameters provided in **kwargs may override dsn parameters.
132
+ :note: when using "udp+influxdb" the specified port (if any) will be
133
+ used for the TCP connection; specify the udp port with the additional
134
+ udp_port parameter (cf. examples).
119
135
:raise ValueError: if the provided DSN has any unexpected value.
120
136
"""
121
137
dsn = dsn .lower ()
You can’t perform that action at this time.
0 commit comments