Refactor retailer collection entrypoints
This commit is contained in:
65
collect_costco_web.py
Normal file
65
collect_costco_web.py
Normal file
@@ -0,0 +1,65 @@
|
||||
import click
|
||||
|
||||
import scrape_costco
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option(
|
||||
"--outdir",
|
||||
default="data/costco-web",
|
||||
show_default=True,
|
||||
help="Directory for Costco raw and collected outputs.",
|
||||
)
|
||||
@click.option(
|
||||
"--document-type",
|
||||
default="all",
|
||||
show_default=True,
|
||||
help="Summary document type.",
|
||||
)
|
||||
@click.option(
|
||||
"--document-sub-type",
|
||||
default="all",
|
||||
show_default=True,
|
||||
help="Summary document sub type.",
|
||||
)
|
||||
@click.option(
|
||||
"--window-days",
|
||||
default=92,
|
||||
show_default=True,
|
||||
type=int,
|
||||
help="Maximum number of days to request per summary window.",
|
||||
)
|
||||
@click.option(
|
||||
"--months-back",
|
||||
default=36,
|
||||
show_default=True,
|
||||
type=int,
|
||||
help="How many months of receipts to enumerate back from today.",
|
||||
)
|
||||
@click.option(
|
||||
"--firefox-profile-dir",
|
||||
default=None,
|
||||
help="Firefox profile directory to use for cookies and session storage.",
|
||||
)
|
||||
def main(
|
||||
outdir,
|
||||
document_type,
|
||||
document_sub_type,
|
||||
window_days,
|
||||
months_back,
|
||||
firefox_profile_dir,
|
||||
):
|
||||
scrape_costco.run_collection(
|
||||
outdir=outdir,
|
||||
document_type=document_type,
|
||||
document_sub_type=document_sub_type,
|
||||
window_days=window_days,
|
||||
months_back=months_back,
|
||||
firefox_profile_dir=firefox_profile_dir,
|
||||
orders_filename="collected_orders.csv",
|
||||
items_filename="collected_items.csv",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user