Skip to content

Commit 1197ec7

Browse files
committed
fix generate url map to add channel path
If channel is empty string, url end with '/'. This regard as empty string of channel path. Mainnet `iconrpcserver` using default channel if channel path is None. Empty string of channel path raise exception.
1 parent 3b95eef commit 1197ec7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

iconsdk/providers/http_provider.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,14 @@ def __init__(self, full_path_url: str, request_kwargs: dict = None):
6969
self._generate_url_map()
7070

7171
def _generate_url_map(self):
72+
def _add_channel_path(url: str):
73+
if self._channel:
74+
return f"{url}/{self._channel}"
75+
return url
76+
7277
self._URL_MAP = {
73-
'icx': "{0}/api/v{1}/{2}".format(self._serverUri, self._version, self._channel),
74-
'debug': "{0}/api/debug/v{1}/{2}".format(self._serverUri, self._version, self._channel)
78+
'icx': _add_channel_path(f"{self._serverUri}/api/v{self._version}"),
79+
'debug': _add_channel_path(f"{self._serverUri}/api/debug/v{self._version}")
7580
}
7681

7782
@staticmethod

0 commit comments

Comments
 (0)