diff --git a/toot/commands.py b/toot/commands.py
index 78c4fab..808c484 100644
--- a/toot/commands.py
+++ b/toot/commands.py
@@ -6,7 +6,7 @@ from datetime import datetime, timedelta, timezone
from time import sleep, time
from toot import api, config, __version__
from toot.auth import login_interactive, login_browser_interactive, create_app_interactive
-from toot.entities import Instance, Notification, Status, from_dict
+from toot.entities import Account, Instance, Notification, Status, from_dict
from toot.exceptions import ApiError, ConsoleError
from toot.output import (print_lists, print_out, print_instance, print_account, print_acct_list,
print_search_results, print_status, print_timeline, print_notifications, print_tag_list,
@@ -520,12 +520,13 @@ def whoami(app, user, args):
if args.json:
print(response.text)
else:
- account = response.json()
+ account = from_dict(Account, response.json())
print_account(account)
def whois(app, user, args):
account = api.find_account(app, user, args.account)
+ account = from_dict(Account, account)
print_account(account)
diff --git a/toot/output.py b/toot/output.py
index 83898f8..bf5ee87 100644
--- a/toot/output.py
+++ b/toot/output.py
@@ -5,8 +5,8 @@ import textwrap
from functools import lru_cache
from toot import settings
-from toot.entities import Instance, Notification, Poll, Status
from toot.utils import get_text, html_to_paragraphs
+from toot.entities import Account, Instance, Notification, Poll, Status
from toot.wcstring import wc_wrap
from typing import List
from wcwidth import wcswidth
@@ -170,31 +170,33 @@ def print_instance(instance: Instance):
print_out(f"Contact: {contact.display_name} @{contact.acct}")
-def print_account(account):
- print_out(f"@{account['acct']} {account['display_name']}")
+def print_account(account: Account):
+ print_out(f"@{account.acct} {account.display_name}")
- if account["note"]:
+ if account.note:
print_out("")
- print_html(account["note"])
+ print_html(account.note)
+
+ since = account.created_at.strftime('%Y-%m-%d')
print_out("")
- print_out(f"ID: {account['id']}")
- print_out(f"Since: {account['created_at'][:10]}")
+ print_out(f"ID: {account.id}")
+ print_out(f"Since: {since}")
print_out("")
- print_out(f"Followers: {account['followers_count']}")
- print_out(f"Following: {account['following_count']}")
- print_out(f"Statuses: {account['statuses_count']}")
+ print_out(f"Followers: {account.followers_count}")
+ print_out(f"Following: {account.following_count}")
+ print_out(f"Statuses: {account.statuses_count}")
- if account["fields"]:
- for field in account["fields"]:
- name = field["name"].title()
+ if account.fields:
+ for field in account.fields:
+ name = field.name.title()
print_out(f'\n{name}:')
- print_html(field["value"])
- if field["verified_at"]:
+ print_html(field.value)
+ if field.verified_at:
print_out("✓ Verified")
print_out("")
- print_out(account["url"])
+ print_out(account.url)
HASHTAG_PATTERN = re.compile(r'(?