Skip to content

Commit 1c4401e

Browse files
committed
Report output from API on error.
1 parent d794eb8 commit 1c4401e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

alchemyapi.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,10 +762,17 @@ def __analyze(self, endpoint, params, post_data=bytearray()):
762762

763763
post_url = AlchemyAPI.BASE_URL + endpoint + '?' + urlencode(params).encode('utf-8');
764764

765+
results = ""
765766
try:
766767
results = self.s.post(url=post_url, data=post_data)
767-
return results.json()
768768
except Exception as e:
769769
print(e)
770770
return { 'status':'ERROR', 'statusInfo':'network-error' }
771+
try:
772+
return results.json()
773+
except Exception as e:
774+
if results != "":
775+
print(results)
776+
print(e)
777+
return { 'status':'ERROR', 'statusInfo':'parse-error' }
771778

0 commit comments

Comments
 (0)