Skip to content

Commit

Permalink
Merge pull request #4986 from GSA/date-in-filename
Browse files Browse the repository at this point in the history
put date into filenames
  • Loading branch information
Jin-Sun-tts authored Nov 27, 2024
2 parents 6463553 + c08ce15 commit 62f0885
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion metrics/datagov_metrics/ckan.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import csv
import io
from datagov_metrics.s3_util import put_data_to_s3
from datagov_metrics.ga import date_range_last_month

CKAN_BASE_URL = "https://catalog.data.gov/api/action/package_search"
QUERIES = {
Expand Down Expand Up @@ -34,9 +35,10 @@ def write_data_to_csv(response):

def main():
data = get_data()
end_date = date_range_last_month()[0]["endDate"] # for example, 2024-10-31
for k, v in data.items():
csv_data = write_data_to_csv(v)
put_data_to_s3(f"global__{k}.csv", csv_data)
put_data_to_s3(f"global__{k}.{end_date}.csv", csv_data)


if __name__ == "__main__":
Expand Down

0 comments on commit 62f0885

Please sign in to comment.