Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0d7d95b

Browse files
committed
Make the auth info and host parsing simpler
1 parent 7dabe32 commit 0d7d95b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

rethinkdb/net.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -725,11 +725,10 @@ def make_connection(
725725
connection_string = urlparse(url)
726726
query_string = parse_qs(connection_string.query)
727727

728-
# Reverse the tuple, this way we can ensure that the host:port/user:pass
729-
# will be always at the same position
730-
host_port, _, user_pass = connection_string.netloc.partition("@")[::-1]
731-
user, password = user_pass.partition(":")[0], user_pass.partition(":")[2]
732-
host, port = host_port.partition(":")[0], host_port.partition(":")[2]
728+
user = connection_string.username
729+
password = connection_string.password
730+
host = connection_string.hostname
731+
port = connection_string.port
733732

734733
db = connection_string.path.replace("/", "") or None
735734
auth_key = query_string.get("auth_key")

0 commit comments

Comments
 (0)