Skip to content

Commit ed0a426

Browse files
committed
Remove unnecessary while loop
1 parent 30c1195 commit ed0a426

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

iconsdk/providers/http_provider.py

+7-12
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,13 @@ def make_request(self, method: str, params=None, full_response: bool = False) ->
118118
rpc_dict['params'] = params
119119

120120
req_key = method.split('_')[0]
121-
retry_count = 2
122-
raw_response = ''
123-
while retry_count > 0:
124-
request_url = self._URL_MAP.get(req_key)
125-
response = self._make_post_request(request_url, rpc_dict, **self._get_request_kwargs())
126-
try:
127-
return self._return_custom_response(response, full_response)
128-
except JSONDecodeError:
129-
retry_count -= 1
130-
raw_response = response.content.decode()
131-
132-
raise JSONRPCException(f'Unknown response: {raw_response}')
121+
request_url = self._URL_MAP.get(req_key)
122+
response = self._make_post_request(request_url, rpc_dict, **self._get_request_kwargs())
123+
try:
124+
return self._return_custom_response(response, full_response)
125+
except JSONDecodeError:
126+
raw_response = response.content.decode()
127+
raise JSONRPCException(f'Unknown response: {raw_response}')
133128

134129
@staticmethod
135130
def _return_custom_response(response: requests.Response, full_response: bool = False) -> Union[str, list, dict]:

tests/providers/test_http_provider.py

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
class TestHTTPProvider(TestSendSuper):
2424
FULL_PATH_URL = "http://localhost:9000/api/v3"
25-
DEBUG_FULL_PATH_URL = "http://localhost:9000/api/debug/v3"
2625
BASE_PATH_URL = "http://localhost:9000"
2726
VERSION = 3
2827

0 commit comments

Comments
 (0)