Skip to content

Commit 850620f

Browse files
committed
Fixed renaming bug
1 parent 48ac3fe commit 850620f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

scripts/python/web_scraper.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -861,11 +861,8 @@ def scrape_tariff_data(self, username, password, query_params, data_columns, cou
861861
# Extract CSV from downloaded zip and move to resources
862862
csv_path = self.get_csv_file_from_zip()
863863

864-
# Rename CSV file if country_code and year are provided
865-
if country_code and year:
866-
csv_filename = self.rename_csv_file(csv_path, country_code, year)
867-
else:
868-
csv_filename = os.path.basename(csv_path)
864+
# Rename CSV file
865+
csv_filename = self.rename_csv_file(csv_path, country_code, year if year else self.latest_year)
869866

870867
print(f"Tariff data download completed successfully. File: {csv_filename}")
871868
return csv_filename # Return filename instead of True

0 commit comments

Comments
 (0)