Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Commit

Permalink
Merge 5ea13e4 into 7f0d729
Browse files Browse the repository at this point in the history
  • Loading branch information
f27d committed Jan 10, 2019
2 parents 7f0d729 + 5ea13e4 commit cf3bbc8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions neorpc/Client.py
Expand Up @@ -397,13 +397,15 @@ def __init__(self, client, address):
self.addr = address

def setup(self):
try:
response = requests.post(self.addr, json={'jsonrpc': '2.0', 'method': GET_BLOCK_COUNT, 'params': [], 'id': 1}, timeout=TIMEOUT)
self.update_endpoint_details(response)

response = requests.post(self.addr, json={'jsonrpc': '2.0', 'method': GET_BLOCK_COUNT, 'params': [], 'id': 1})
self.update_endpoint_details(response)

if response.status_code == 200:
json = response.json()
self.height = int(json['result'])
if response.status_code == 200:
json = response.json()
self.height = int(json['result'])
except Exception as e:
raise NEORPCException("Could not setup %s : %s " % (self.addr, e))

def update_endpoint_details(self, response):

Expand All @@ -427,7 +429,6 @@ def _compare(self, other):
else:
return -1
else:

if self.height < other.height:
return 1
else:
Expand Down

0 comments on commit cf3bbc8

Please sign in to comment.