Merge branch 'master' of github.com:elasticsearch/elasticsearch-py
This commit is contained in:
@@ -3,7 +3,7 @@ import logging
|
|||||||
|
|
||||||
from ..transport import Transport
|
from ..transport import Transport
|
||||||
from ..exceptions import TransportError
|
from ..exceptions import TransportError
|
||||||
from ..compat import string_types, urlparse
|
from ..compat import string_types, urlparse, unquote
|
||||||
from .indices import IndicesClient
|
from .indices import IndicesClient
|
||||||
from .ingest import IngestClient
|
from .ingest import IngestClient
|
||||||
from .cluster import ClusterClient
|
from .cluster import ClusterClient
|
||||||
@@ -49,7 +49,8 @@ def _normalize_hosts(hosts):
|
|||||||
h['scheme'] = parsed_url.scheme
|
h['scheme'] = parsed_url.scheme
|
||||||
|
|
||||||
if parsed_url.username or parsed_url.password:
|
if parsed_url.username or parsed_url.password:
|
||||||
h['http_auth'] = '%s:%s' % (parsed_url.username, parsed_url.password)
|
h['http_auth'] = '%s:%s' % (unquote(parsed_url.username),
|
||||||
|
unquote(parsed_url.password))
|
||||||
|
|
||||||
if parsed_url.path and parsed_url.path != '/':
|
if parsed_url.path and parsed_url.path != '/':
|
||||||
h['url_prefix'] = parsed_url.path
|
h['url_prefix'] = parsed_url.path
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ PY2 = sys.version_info[0] == 2
|
|||||||
|
|
||||||
if PY2:
|
if PY2:
|
||||||
string_types = basestring,
|
string_types = basestring,
|
||||||
from urllib import quote_plus, urlencode
|
from urllib import quote_plus, urlencode, unquote
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
from itertools import imap as map
|
from itertools import imap as map
|
||||||
else:
|
else:
|
||||||
string_types = str, bytes
|
string_types = str, bytes
|
||||||
from urllib.parse import quote_plus, urlencode, urlparse
|
from urllib.parse import quote_plus, urlencode, urlparse, unquote
|
||||||
map = map
|
map = map
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ class TestNormalizeHosts(TestCase):
|
|||||||
|
|
||||||
def test_strings_are_parsed_for_port_and_user(self):
|
def test_strings_are_parsed_for_port_and_user(self):
|
||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
[{"host": "elastic.co", "port": 42}, {"host": "elastic.co", "http_auth": "user:secret"}],
|
[{"host": "elastic.co", "port": 42}, {"host": "elastic.co", "http_auth": "user:secre]"}],
|
||||||
_normalize_hosts(["elastic.co:42", "user:secret@elastic.co"])
|
_normalize_hosts(["elastic.co:42", "user:secre%5D@elastic.co"])
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_strings_are_parsed_for_scheme(self):
|
def test_strings_are_parsed_for_scheme(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user