Skip to content

Commit

Permalink
update cli
Browse files Browse the repository at this point in the history
  • Loading branch information
MJedr committed Oct 5, 2023
1 parent a50e851 commit 94d79f1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions matomo-api/src/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
@click.command()
@click.option("--date", "-d", default=date.today())
def fetch_matomo_inspire_data(date: str):
click.echo(f"Fetching data for date {date}")
if isinstance(date, str):
try:
date_datetime = datetime.strptime(date, "%Y-%M-%d")
date = datetime.strptime(date, "%Y-%M-%d")
except ValueError:
click.echo("Wrong date format! Aborting.")
return

matomo = MatomoAPI()
matomo.fetch_inspire_statistics(date_datetime)
matomo.fetch_inspire_statistics(date)


if __name__ == "__main__":
Expand Down

0 comments on commit 94d79f1

Please sign in to comment.