33from typing import Any , List
44
55import pytz
6- import requests
76from pystac import Collection , Item
87
98from pystac_monty .extension import (
@@ -36,13 +35,13 @@ class GFDTransformer:
3635 """Transform the source data into the STAC items"""
3736
3837 gfd_events_collection_id = "gfd-events"
39- gfd_events_collection_url = "../.. /monty-stac-extension/examples/gfd-events/gfd-events.json" # noqa
38+ gfd_events_collection_url = "./monty-stac-extension/examples/gfd-events/gfd-events.json" # noqa
4039
4140 gfd_hazards_collection_id = "gfd-hazards"
42- gfd_hazards_collection_url = "../.. /monty-stac-extension/examples/gfd-hazards/gfd-hazards.json" # noqa
41+ gfd_hazards_collection_url = "./monty-stac-extension/examples/gfd-hazards/gfd-hazards.json" # noqa
4342
4443 gfd_impacts_collection_id = "gfd-impacts"
45- gfd_impacts_collection_url = "../.. /monty-stac-extension/examples/gfd-impacts/gfd-impacts.json" # noqa
44+ gfd_impacts_collection_url = "./monty-stac-extension/examples/gfd-impacts/gfd-impacts.json" # noqa
4645 hazard_profiles = MontyHazardProfiles ()
4746
4847 def __init__ (self , data : GFDDataSource ):
@@ -63,23 +62,23 @@ def make_items(self) -> List[Item]:
6362
6463 return items
6564
66- def get_event_collection (self , timeout : int = 30 ) -> Collection :
65+ def get_event_collection (self ) -> Collection :
6766 """Get Event collection"""
68- response = open (self .gfd_events_collection_url )
69- collection_dict = json .loads ( response . text )
70- return Collection .from_dict (collection_dict )
67+ with open (self .gfd_events_collection_url , "r" , encoding = "utf-8" ) as f :
68+ response = json .load ( f )
69+ return Collection .from_dict (response )
7170
72- def get_hazard_collection (self , timeout : int = 30 ) -> Collection :
71+ def get_hazard_collection (self ) -> Collection :
7372 """Get Hazard collection"""
74- response = open (self .gfd_hazards_collection_url )
75- collection_dict = json .loads ( response . text )
76- return Collection .from_dict (collection_dict )
73+ with open (self .gfd_hazards_collection_url , "r" , encoding = "utf-8" ) as f :
74+ response = json .load ( f )
75+ return Collection .from_dict (response )
7776
78- def get_impact_collection (self , timeout : int = 30 ) -> Collection :
77+ def get_impact_collection (self ) -> Collection :
7978 """Get Impact collection"""
80- response = open (self .gfd_impacts_collection_url )
81- collection_dict = json .loads ( response . text )
82- return Collection .from_dict (collection_dict )
79+ with open (self .gfd_impacts_collection_url , "r" , encoding = "utf-8" ) as f :
80+ response = json .load ( f )
81+ return Collection .from_dict (response )
8382
8483 def _get_bounding_box (self , polygon : list ):
8584 """Get the bounding box from the polygon"""
0 commit comments