diff --git a/toot/api.py b/toot/api.py index 79f88d4..ec57f0c 100644 --- a/toot/api.py +++ b/toot/api.py @@ -219,6 +219,6 @@ def get_notifications(app, user): return http.get(app, user, '/api/v1/notifications').json() -def get_instance(domain): - url = "http://{}/api/v1/instance".format(domain) +def get_instance(domain, scheme="https"): + url = "{}://{}/api/v1/instance".format(scheme, domain) return http.anon_get(url).json() diff --git a/toot/auth.py b/toot/auth.py index 51b4f0f..eb9e3c8 100644 --- a/toot/auth.py +++ b/toot/auth.py @@ -12,7 +12,7 @@ from toot.output import print_out def register_app(domain, scheme='https'): print_out("Looking up instance info...") - instance = api.get_instance(domain) + instance = api.get_instance(domain, scheme) print_out("Found instance {} running Mastodon version {}".format( instance['title'], instance['version'])) diff --git a/toot/commands.py b/toot/commands.py index ee34b0d..4a74dfc 100644 --- a/toot/commands.py +++ b/toot/commands.py @@ -219,7 +219,7 @@ def instance(app, user, args): assert_domain_exists(name) try: - instance = api.get_instance(name) + instance = api.get_instance(name, args.scheme) print_instance(instance) except NotFoundError: raise ConsoleError( diff --git a/toot/console.py b/toot/console.py index 3fdc386..4b0883f 100644 --- a/toot/console.py +++ b/toot/console.py @@ -131,7 +131,7 @@ READ_COMMANDS = [ "help": "instance domain (e.g. 'mastodon.social') or blank to use current", "nargs": "?", }), - + scheme_arg, ], require_auth=False, ),