We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f03fb5c + b158c2d commit dc375ddCopy full SHA for dc375dd
etherscan/client.py
@@ -1,5 +1,4 @@
1
import requests
2
-import json
3
import collections
4
5
# Assume user puts his API key in the api_key.json file under variable name "key"
@@ -82,11 +81,17 @@ def connect(self):
82
81
try:
83
req = self.http.get(self.url)
84
except requests.exceptions.ConnectionError:
85
- return "Connection refused"
+ print("Connection refused")
+ exit()
86
+
87
if req.status_code == 200:
88
# Check for empty response
89
if req.text:
- return json.loads(req.text)
90
+ if req.json()['status'] == '1':
91
+ return req.json()
92
+ else:
93
+ print(req.json()['message'])
94
95
else:
96
print("Invalid Request")
97
exit()
0 commit comments