-
Notifications
You must be signed in to change notification settings - Fork 11
/
get_all_filings_settings_since_date.py
50 lines (37 loc) · 1.21 KB
/
get_all_filings_settings_since_date.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Script to get all filings and settings since a given dates.
To use:
python get_all_filings_since_date.py (m)m-(d)d-yyyy
"""
from datetime import date, timedelta
import sys
from typing import List, Tuple
import logging
import click
import get_all_filings_settings_between_dates as get_filings
import scrapers
logger = logging.getLogger()
logging.basicConfig(stream=sys.stdout)
logger.setLevel(logging.INFO)
def get_all_filings_settings_since_date(start_date: date, county: str):
"""
Get all filings and settings since `start_date`.
Splits queries up by week. Logs the weeks that failed.
"""
yesterdays_date = date.today() - timedelta(days=1)
get_filings.get_all_filings_settings_between_dates(
start_date=start_date, end_date=yesterdays_date, county=county
)
if __name__ == "__main__":
@click.command()
@click.argument(
"date", type=click.DateTime(formats=["%Y-%m-%d", "%m-%d-%Y", "%m/%d/%Y"])
)
@click.option(
"--county",
type=click.Choice(scrapers.SCRAPER_NAMES, case_sensitive=False),
default="travis",
)
def get_all_since_date(date, county):
get_all_filings_settings_since_date(date, county)
get_all_since_date()