Skip to content

Commit

Permalink
Give preference to supplied place_name on CivicPlusSite.place
Browse files Browse the repository at this point in the history
  • Loading branch information
zstumgoren committed Jun 20, 2023
1 parent 5cecf62 commit 4b51920
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion civic_scraper/platforms/civic_plus/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@
class Site(base.Site):
def __init__(self, base_url, cache=Cache(), parser_kls=Parser, place_name=None):
super().__init__(base_url, cache=cache, parser_kls=parser_kls)
self.base_url = base_url
self.subdomain = urlparse(base_url).netloc.split(".")[0]
self.place = self._get_asset_metadata(r"(?<=-)\w+(?=\.)", base_url)
self.place_name = place_name
self.state_or_province = self._get_asset_metadata(
r"(?<=//)\w{2}(?=-)", base_url
)

@property
def place(self):
return self.place_name or self._get_asset_metadata(r"(?<=-)\w+(?=\.)", self.base_url)

def scrape(
self,
start_date=None,
Expand Down

0 comments on commit 4b51920

Please sign in to comment.