Skip to content

Commit dc375dd

Browse files
authored
Merge pull request corpetty#17 from taylorjdawson/issue-14
Fixed Issue 14
2 parents f03fb5c + b158c2d commit dc375dd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

etherscan/client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import requests
2-
import json
32
import collections
43

54
# Assume user puts his API key in the api_key.json file under variable name "key"
@@ -82,11 +81,17 @@ def connect(self):
8281
try:
8382
req = self.http.get(self.url)
8483
except requests.exceptions.ConnectionError:
85-
return "Connection refused"
84+
print("Connection refused")
85+
exit()
86+
8687
if req.status_code == 200:
8788
# Check for empty response
8889
if req.text:
89-
return json.loads(req.text)
90+
if req.json()['status'] == '1':
91+
return req.json()
92+
else:
93+
print(req.json()['message'])
94+
exit()
9095
else:
9196
print("Invalid Request")
9297
exit()

0 commit comments

Comments
 (0)