Skip to content

Commit 6587076

Browse files
committed
Allow netloc with "."
1 parent 5971d76 commit 6587076

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

influxdb/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ def parse_dsn(dsn):
866866

867867
def _parse_netloc(netloc):
868868
import re
869-
parsed = re.findall(r'(\w*):(\w*)@(\w*):(\d*)', netloc)
869+
parsed = re.findall(r'(\w*):(\w*)@([a-zA-Z0-9_\.]*):(\d*)', netloc)
870870
if not parsed:
871871
raise ValueError('Invalid netloc "{}".'.format(netloc))
872872

influxdb/tests/client_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def setUp(self):
9595
}
9696
]
9797

98-
self.dsn_string = 'influxdb://uSr:pWd@host:1886/db'
98+
self.dsn_string = 'influxdb://uSr:pWd@my.host.fr:1886/db'
9999

100100
def test_scheme(self):
101101
cli = InfluxDBClient('host', 8086, 'username', 'password', 'database')
@@ -108,7 +108,7 @@ def test_scheme(self):
108108

109109
def test_dsn(self):
110110
cli = InfluxDBClient.from_DSN(self.dsn_string)
111-
self.assertEqual('http://host:1886', cli._baseurl)
111+
self.assertEqual('http://my.host.fr:1886', cli._baseurl)
112112
self.assertEqual('uSr', cli._username)
113113
self.assertEqual('pWd', cli._password)
114114
self.assertEqual('db', cli._database)
@@ -118,11 +118,11 @@ def test_dsn(self):
118118
self.assertTrue(cli.use_udp)
119119

120120
cli = InfluxDBClient.from_DSN('https+' + self.dsn_string)
121-
self.assertEqual('https://host:1886', cli._baseurl)
121+
self.assertEqual('https://my.host.fr:1886', cli._baseurl)
122122

123123
cli = InfluxDBClient.from_DSN('https+' + self.dsn_string,
124124
**{'ssl': False})
125-
self.assertEqual('http://host:1886', cli._baseurl)
125+
self.assertEqual('http://my.host.fr:1886', cli._baseurl)
126126

127127
def test_switch_database(self):
128128
cli = InfluxDBClient('host', 8086, 'username', 'password', 'database')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy