Skip to content

Commit

Permalink
Make sure all facet values are strings before formatting them
Browse files Browse the repository at this point in the history
  • Loading branch information
John Matherly committed Sep 12, 2018
1 parent 9edd057 commit 3fadcef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion shodan/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,10 @@ def stats(limit, facets, filename, query):
click.echo('Top {} Results for Facet: {}'.format(len(results['facets'][facet]), facet))

for item in results['facets'][facet]:
click.echo(click.style(u'{:28s}'.format(item['value']), fg='cyan'), nl=False)
# Force the value to be a string - necessary because some facet values are numbers
value = u'{}'.format(item['value'])

click.echo(click.style(u'{:28s}'.format(value), fg='cyan'), nl=False)
click.echo(click.style(u'{:12,d}'.format(item['count']), fg='green'))

click.echo('')
Expand Down

0 comments on commit 3fadcef

Please sign in to comment.