Skip to content

Commit

Permalink
incase api is down
Browse files Browse the repository at this point in the history
  • Loading branch information
phattd15 committed Nov 14, 2021
1 parent e1da8f7 commit b2e9218
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions base/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@

def read_data(url):
response = urlopen(url)
response_data = json.loads(response.read())
if "result" in response_data:
return response_data["result"]
else:
response_data = []
try:
response_data = json.loads(response.read())

if "result" in response_data:
return response_data["result"]

else:
return []

except:
return []


Expand Down

0 comments on commit b2e9218

Please sign in to comment.