Wrap API calls in helper and validate response
This commit is contained in:
@@ -39,7 +39,15 @@ class AccountInfo(LoginRequiredMixin, View):
|
||||
}
|
||||
return render(request, template_name, context)
|
||||
|
||||
live_info = dict(account.client.get_account())
|
||||
success, live_info = account.client.get_account()
|
||||
if not success:
|
||||
context = {
|
||||
"message": "Could not get account info",
|
||||
"class": "danger",
|
||||
"window_content": self.window_content,
|
||||
}
|
||||
return render(request, template_name, context)
|
||||
live_info = live_info
|
||||
account_info = account.__dict__
|
||||
account_info = {
|
||||
k: v for k, v in account_info.items() if k in self.VIEWABLE_FIELDS_MODEL
|
||||
|
||||
Reference in New Issue
Block a user