data_manager module

ziptimezone.data_manager.download_and_extract_zip_data(data_url, data_directory)[source]

Downloads and extracts ZIP code data, then loads it into memory.

Parameters:
  • data_url (str) – URL from which to download the ZIP file.

  • data_directory (str) – Directory to store and extract data.

ziptimezone.data_manager.get_data_file_path()[source]

Constructs the file path for storing the data file within the package.

Returns:

The file path where the data file should be stored. This path points to a directory ‘data’ at the same level as this script.

Return type:

str

ziptimezone.data_manager.refresh_data_if_needed()[source]

Ensures that ZIP code data is loaded upon initial import or application startup. This can also be called later if needed. Deletes existing data directory if it exists, and re-downloads and extracts the ZIP file.