Add --json option to search command
This commit is contained in:
parent
0c37716de1
commit
ae7a36b8d8
2 changed files with 6 additions and 3 deletions
|
@ -31,7 +31,7 @@ def find_account(app, user, account_name):
|
|||
normalized_name = username
|
||||
|
||||
response = search(app, user, account_name, type="accounts", resolve=True)
|
||||
for account in response["accounts"]:
|
||||
for account in response.json()["accounts"]:
|
||||
if account["acct"].lower() == normalized_name:
|
||||
return account
|
||||
|
||||
|
@ -458,7 +458,7 @@ def search(app, user, query, resolve=False, type=None):
|
|||
"type": type
|
||||
})
|
||||
|
||||
return http.get(app, user, "/api/v2/search", params).json()
|
||||
return http.get(app, user, "/api/v2/search", params)
|
||||
|
||||
|
||||
def follow(app, user, account):
|
||||
|
|
|
@ -367,7 +367,10 @@ def upload(app, user, args):
|
|||
|
||||
def search(app, user, args):
|
||||
response = api.search(app, user, args.query, args.resolve)
|
||||
print_search_results(response)
|
||||
if args.json:
|
||||
print(response.text)
|
||||
else:
|
||||
print_search_results(response.json())
|
||||
|
||||
|
||||
def _do_upload(app, user, file, description, thumbnail):
|
||||
|
|
Loading…
Reference in a new issue