Proper prompts
This commit is contained in:
parent
e2f67fa552
commit
68a0e30b3f
11
crawl.py
11
crawl.py
@ -49,6 +49,11 @@ parser.add_argument(
|
||||
action='store_true',
|
||||
help='Reverse direction (EUR -> currency)'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--cache-dir',
|
||||
dest='cache_dir',
|
||||
help='Override the default cache directory with your own path'
|
||||
)
|
||||
exc_group = parser.add_mutually_exclusive_group()
|
||||
exc_group.add_argument(
|
||||
'-i', '--interactive',
|
||||
@ -111,7 +116,7 @@ def is_float(string: str) -> bool:
|
||||
return False
|
||||
|
||||
def _retrieve_file(date: DTDate, card_type: List[str] = CARD_VISA) -> BinaryIO: # pylint: disable=dangerous-default-value
|
||||
print('Downloading newest rates...')
|
||||
print('Downloading newest rates...', end='')
|
||||
b = m.Browser()
|
||||
# Firefox 64 User-Agent
|
||||
# ua = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0'
|
||||
@ -190,6 +195,9 @@ if args.date:
|
||||
else:
|
||||
retrieve_date = _get_date()
|
||||
|
||||
if args.cache_dir is not None:
|
||||
filepath = pathlib.Path(os.path.abspath(args.cache_dir))
|
||||
else:
|
||||
filepath = pathlib.Path(appdirs.user_cache_dir('FirstDataCrawler', 'iwonder'))
|
||||
if not filepath.exists():
|
||||
filepath.mkdir(parents=True)
|
||||
@ -209,7 +217,6 @@ else:
|
||||
|
||||
if args.interactive:
|
||||
try:
|
||||
print('Ready.')
|
||||
while True:
|
||||
_process_stdin(input('> '), results)
|
||||
except (KeyboardInterrupt, EOFError):
|
||||
|
Loading…
Reference in New Issue
Block a user