Skip to content

Commit 7b1626f

Browse files
committed
Unquote username & password when parsing a DSN
A DSN like: `influxdb://user:sec#ret@host:port` should be written as `influxdb://user:sec%23ret@host:port` RFC 3986 allows characters like # ? to appear in username / password which should be properly unquoted Please see relevant Python bug: https://bugs.python.org/issue18140#msg375109
1 parent 7cb5656 commit 7b1626f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

influxdb/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import requests
2222
import requests.exceptions
2323
from requests.adapters import HTTPAdapter
24-
from six.moves.urllib.parse import urlparse
24+
from six.moves.urllib.parse import urlparse, unquote
2525

2626
from influxdb.line_protocol import make_lines, quote_ident, quote_literal
2727
from influxdb.resultset import ResultSet
@@ -1247,8 +1247,8 @@ def _parse_dsn(dsn):
12471247

12481248
def _parse_netloc(netloc):
12491249
info = urlparse("http://{0}".format(netloc))
1250-
return {'username': info.username or None,
1251-
'password': info.password or None,
1250+
return {'username': unquote(info.username) or None,
1251+
'password': unquote(info.password) or None,
12521252
'host': info.hostname or 'localhost',
12531253
'port': info.port or 8086}
12541254

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