opencivicdata / scrapers-us-municipal

Scrapers for US municipal governments.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Metro timestamps don't always conform to expected format

hancush opened this issue · comments

Over the weekend, we saw a few instances of event scrape failure due to a differently formatted timestamp.

ValueError: time data '13:00' does not match format '%I:%M %p'
  File "bin/pupa", line 8, in <module>
    sys.exit(main())
  File "pupa/cli/__main__.py", line 68, in main
    subcommands[args.subcommand].handle(args, other)
  File "pupa/cli/commands/update.py", line 260, in handle
    return self.do_handle(args, other, juris)
  File "pupa/cli/commands/update.py", line 305, in do_handle
    report['scrape'] = self.do_scrape(juris, args, scrapers)
  File "pupa/cli/commands/update.py", line 173, in do_scrape
    report[scraper_name] = scraper.do_scrape(**scrape_args)
  File "pupa/scrape/base.py", line 111, in do_scrape
    for obj in self.scrape(**kwargs) or []:
  File "lametro/events.py", line 195, in scrape
    for event, web_event in self._merge_events(events):
  File "lametro/events.py", line 128, in _merge_events
    for event, web_event in events:
  File "legistar/events.py", line 206, in events
    start_time = time.strptime(time_str, '%I:%M %p')
  File "python3.5/_strptime.py", line 504, in _strptime_time
    tt = _strptime(data_string, format)[0]
  File "python3.5/_strptime.py", line 343, in _strptime
    (data_string, format))

We should handle this.