Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Allow netloc with "." #266

Merged
merged 1 commit into from
Nov 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion influxdb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ def parse_dsn(dsn):

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

Expand Down
8 changes: 4 additions & 4 deletions influxdb/tests/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def setUp(self):
}
]

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

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

def test_dsn(self):
cli = InfluxDBClient.from_DSN(self.dsn_string)
self.assertEqual('http://host:1886', cli._baseurl)
self.assertEqual('http://my.host.fr:1886', cli._baseurl)
self.assertEqual('uSr', cli._username)
self.assertEqual('pWd', cli._password)
self.assertEqual('db', cli._database)
Expand All @@ -118,11 +118,11 @@ def test_dsn(self):
self.assertTrue(cli.use_udp)

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

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

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