Skip to content

Commit 20ec8e6

Browse files
committed
Update on URL handling
1 parent ba646a2 commit 20ec8e6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

kepconfig/connection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ def __connect(self,request_obj):
261261
data = _HttpDataAbstract()
262262
request_obj.add_header("Authorization", "Basic %s" % self.__build_auth_str(self.username, self.password))
263263
request_obj.add_header("Content-Type", "application/json")
264+
request_obj.add_header("Accept", "application/json")
264265
try:
265266
# context is sent regardless of HTTP or HTTPS - seems to be ignored if HTTP URL
266267
with request.urlopen(request_obj, context=self.__ssl_context) as server:
@@ -284,7 +285,8 @@ def __connect(self,request_obj):
284285
# Ex: Space will be turned to %20
285286
def __url_validate(self, url):
286287
parsed_url = parse.urlparse(url)
287-
updated_path = parse.quote(parsed_url.path)
288+
# Added % for scenarios where special characters have already been escaped with %
289+
updated_path = parse.quote(parsed_url.path, safe = '/%')
288290

289291
# If host is "localhost", force using the IPv4 loopback adapter IP address in all calls
290292
# This is done to remove retries that will happen when the host resolution uses IPv6 intially

0 commit comments

Comments
 (0)