Refactor retailer collection entrypoints
This commit is contained in:
34
collect_giant_web.py
Normal file
34
collect_giant_web.py
Normal file
@@ -0,0 +1,34 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user