Skip to content

Commit fe3e97f

Browse files
committed
working child objects
Signed-off-by: John Seekins <[email protected]>
1 parent 9e00815 commit fe3e97f

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

enricher.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ def enrich_facility(facility_data: tuple) -> tuple:
4040
logger.info("Enriching facility %s...", facility_name)
4141
enriched_facility = copy.deepcopy(facility)
4242

43-
wiki = wikipedia.Wikipedia({"facility_name": facility_name})
43+
wiki = wikipedia.Wikipedia(facility_name=facility_name)
4444
wiki_res = wiki.search()
45-
wd = wikidata.Wikidata({"facility_name": facility_name})
45+
wd = wikidata.Wikidata(facility_name=facility_name)
4646
wd_res = wd.search()
47-
osm = openstreetmap.OpenStreetMap({"facility_name": facility_name, "address": facility.get("address", {})})
47+
osm = openstreetmap.OpenStreetMap(facility_name=facility_name, address=facility.get("address", {}))
4848
osm_res = osm.search()
4949
enriched_facility["wikipedia"]["page_url"] = wiki_res.get("url", "")
5050
enriched_facility["wikipedia"]["search_query"] = wiki_res.get("search_query_steps", "")

enrichers/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def search(self) -> dict:
2626

2727
def _req(self, url: str, params: dict = {}, timeout: int = 10) -> requests.Response:
2828
"""requests response wrapper to ensure we honor waits"""
29-
response = session.get(url, allow_redirects=True, timeout=timeout)
29+
30+
response = session.get(url, allow_redirects=True, timeout=timeout, params=params)
3031
response.raise_for_status()
3132
time.sleep(self.wait_time)
3233
return response

enrichers/openstreetmap.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def search(self) -> dict:
2323
self.resp_info["search_query_steps"].append(search_name) # type: ignore [attr-defined]
2424
try:
2525
response = self._req(search_url, params=params, timeout=15)
26+
logger.debug("Response: %s", response.text)
2627
data = response.json()
2728
except Exception as e:
2829
logger.debug(" OSM search error for '%s': %s", facility_name, e)

enrichers/wikipedia.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from enrichers import Enrichment
2+
import requests
23
from urllib.parse import quote
34
from utils import logger
45

@@ -36,7 +37,6 @@ def search(self) -> dict:
3637
except Exception as e:
3738
logger.debug(" Wikipedia search error for '%s': %s", wiki_url, e)
3839
self.resp_info["search_query_steps"].append(f"(Failed -> {e})") # type: ignore [attr-defined]
39-
if response.status_code != 200:
4040
wiki_url = f"{self.static_search}{quote(facility_name.replace(' ', '_').replace('|', '_'))}"
4141
self.resp_info["search_query_steps"].append(wiki_url) # type: ignore [attr-defined]
4242
try:

0 commit comments

Comments
 (0)