Make get_instance return the response instead of json
This commit is contained in:
parent
3f680312c6
commit
9664d71b57
4 changed files with 5 additions and 5 deletions
|
@ -41,7 +41,7 @@ ASSETS_DIR = str(Path(__file__).parent.parent / "assets")
|
|||
|
||||
|
||||
def create_app(base_url):
|
||||
instance = api.get_instance(base_url)
|
||||
instance = api.get_instance(base_url).json()
|
||||
response = api.create_app(base_url)
|
||||
return App(instance["uri"], base_url, response["client_id"], response["client_secret"])
|
||||
|
||||
|
|
|
@ -558,9 +558,9 @@ def clear_notifications(app, user):
|
|||
http.post(app, user, '/api/v1/notifications/clear')
|
||||
|
||||
|
||||
def get_instance(base_url):
|
||||
def get_instance(base_url: str) -> Response:
|
||||
url = f"{base_url}/api/v1/instance"
|
||||
return http.anon_get(url).json()
|
||||
return http.anon_get(url)
|
||||
|
||||
|
||||
def get_lists(app, user):
|
||||
|
|
|
@ -542,7 +542,7 @@ def instance(app, user, args):
|
|||
raise ConsoleError("Please specify an instance.")
|
||||
|
||||
try:
|
||||
instance = api.get_instance(base_url)
|
||||
instance = api.get_instance(base_url).json()
|
||||
instance = from_dict(Instance, instance)
|
||||
print_instance(instance)
|
||||
except ApiError:
|
||||
|
|
|
@ -306,7 +306,7 @@ class TUI(urwid.Frame):
|
|||
See: https://github.com/mastodon/mastodon/issues/19328
|
||||
"""
|
||||
def _load_instance():
|
||||
return api.get_instance(self.app.base_url)
|
||||
return api.get_instance(self.app.base_url).json()
|
||||
|
||||
def _done(instance):
|
||||
self.max_toot_chars = get_max_toot_chars(instance, DEFAULT_MAX_TOOT_CHARS)
|
||||
|
|
Loading…
Reference in a new issue