Skip to content

Commit f3ceb5f

Browse files
committed
update provider
1 parent de4ed7c commit f3ceb5f

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

tronapi/providers.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(self, host, timeout=30000, user=False, password=False, headers=None
2323
scheme, base_url, port = get_host(host)
2424

2525
if isnan(timeout) or timeout < 0:
26-
exit('Invalid timeout duration provided')
26+
raise Exception('Invalid timeout duration provided')
2727

2828
if scheme == 'http':
2929
self.client = urllib3.HTTPConnectionPool(host=base_url, port=port, timeout=timeout, headers=headers)
@@ -33,9 +33,8 @@ def __init__(self, host, timeout=30000, user=False, password=False, headers=None
3333
def request(self, url, body=None, method='GET'):
3434

3535
method = method.lower()
36-
3736
if method not in ['get', 'post']:
38-
exit('The method is not defined')
37+
raise Exception('The method is not defined')
3938

4039
if method == 'post':
4140
response = self.client.request(method=method, url=url, body=json.dumps(body)).data.decode('utf-8')
@@ -45,15 +44,7 @@ def request(self, url, body=None, method='GET'):
4544
return json.loads(response)
4645

4746
def is_connected(self):
48-
"""Проверка соединения с подключенного нода
49-
50-
Examples:
51-
>>> tron.full_node.is_connected()
52-
53-
Returns:
54-
True успешно подключено.
55-
"""
56-
47+
"""Проверка соединения с подключенного нода"""
5748
if self.host:
5849
response = self.request(self.status_page)
5950
return 'blockID' in response

0 commit comments

Comments
 (0)