Skip to content

Commit

Permalink
Clean up dateutil import
Browse files Browse the repository at this point in the history
  • Loading branch information
SimmonsRitchie committed Dec 15, 2023
1 parent 67fc0fd commit b49c03b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion city_scrapers/spiders/chi_police_district_councils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _parse_meeting(self, response):

try:
start = self._parse_start_from_pdf(pdf)
except (KeyError, parser._parser.ParserError):
except (KeyError, parser.ParserError):
start = self._parse_start_from_url_text(response.meta["url_text"])

meeting = Meeting(
Expand Down
7 changes: 3 additions & 4 deletions city_scrapers/spiders/il_sports_facilities_authority.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from city_scrapers_core.items import Meeting
from city_scrapers_core.spiders import CityScrapersSpider
from dateutil import parser
from dateutil.parser import parse


class IlSportsFacilitiesAuthoritySpider(CityScrapersSpider):
Expand Down Expand Up @@ -84,16 +83,16 @@ def _parse_title(self, meeting_title):

def _parse_next_start(self, item):
"""Parse start datetime as a naive datetime object."""
return parse(" ".join(item.split("–")[:-1]))
return parser.parse(" ".join(item.split("–")[:-1]))

def _parse_start(self, item):
"""Parse start datetime as a naive datetime object."""
parts = item.css("::text").get().split()
if len(parts) == 0:
return
try:
return parse(parts[-1])
except parser._parser.ParserError:
return parser.parse(parts[-1])
except parser.ParserError:
return

def _parse_links(self, item):
Expand Down

0 comments on commit b49c03b

Please sign in to comment.