35 lines
778 B
Python
35 lines
778 B
Python
import click
|
|
|
|
import scrape_giant
|
|
|
|
|
|
@click.command()
|
|
@click.option("--user-id", default=None, help="Giant user id.")
|
|
@click.option("--loyalty", default=None, help="Giant loyalty number.")
|
|
@click.option(
|
|
"--outdir",
|
|
default="data/giant-web",
|
|
show_default=True,
|
|
help="Directory for raw json and collected csv outputs.",
|
|
)
|
|
@click.option(
|
|
"--sleep-seconds",
|
|
default=1.5,
|
|
show_default=True,
|
|
type=float,
|
|
help="Delay between order detail requests.",
|
|
)
|
|
def main(user_id, loyalty, outdir, sleep_seconds):
|
|
scrape_giant.run_collection(
|
|
user_id,
|
|
loyalty,
|
|
outdir,
|
|
sleep_seconds,
|
|
orders_filename="collected_orders.csv",
|
|
items_filename="collected_items.csv",
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|