dbc_path = f"{self.get_dir(year)}/{filename}"
resource = next(self.get_resources("ferc1", year=year))
z = zipfile.ZipFile(resource["path"])
try:
f = z.open(dbc_path)
except KeyError:
raise KeyError(f"{dbc_path} is not available in {year} archive.")
return f
After Change
return self.dbc_path[year]
def get_file(self, year: int, filename: str):
if year not in self._cache:
self._cache[year] = self.datastore.get_zipfile_resource("ferc1", year=year)
archive = self._cache[year]
try: