Skip to content

Commit

Permalink
Fix bug where header with empty body is printed even with available-o…
Browse files Browse the repository at this point in the history
…nly flag

- Remove unneeded conditionals and variables
  • Loading branch information
iojw committed Jun 7, 2020
1 parent 68ddc04 commit 2b7fec1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions socialscan/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import asyncio
import sys
import time
from collections import namedtuple
from collections import namedtuple, defaultdict
from operator import attrgetter

import aiohttp
Expand Down Expand Up @@ -89,7 +89,7 @@ def init_parser():

def pretty_print(results, *, view_value, available_only, show_urls):
for key, responses in results.items():
if responses == [] and (available_only or view_value == "query"):
if available_only and not [r for r in responses if r.available]:
continue

header = (
Expand Down Expand Up @@ -157,14 +157,12 @@ async def main():
proxy_list.append(line.strip("\n"))
if args.view_key == "query":
view_value = "platform"
key_iter = queries
elif args.view_key == "platform":
view_value = "query"
key_iter = Platforms

async with aiohttp.ClientSession() as session:
checkers = init_checkers(session, proxy_list=proxy_list)
results = {key: [] for key in key_iter}
results = defaultdict(list)
if args.cache_tokens:
print("Caching tokens...", end="")
await asyncio.gather(*(init_prerequest(platform, checkers) for platform in platforms))
Expand Down

0 comments on commit 2b7fec1

Please sign in to comment.