Skip to content

Commit

Permalink
Add Logging of Unified CSV URL
Browse files Browse the repository at this point in the history
  • Loading branch information
Neal Chambers committed Mar 4, 2024
1 parent 4aaaadc commit 38d75c8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dali/plugin/pair_converter/csv/kraken.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
_GOOGLE_APIS_URL: str = "https://www.googleapis.com/drive/v3/files"
_ID: str = "id"

# The URL for downloading the actual file from Google Drive with security params
_GOOGLE_DRIVE_DOWNLOAD_URL: str = "https://drive.usercontent.google.com/download"

# File ID for the unified CSV file ID. This will need to be replaced every quarter.
_UNIFIED_CSV_FILE_ID: str = "16YKyFkYlvawCHv3W7WuTFzM8RYgMRWMt"
_MESSAGE: str = "message"
Expand Down Expand Up @@ -230,9 +233,11 @@ def __download_unified_csv(self) -> None:

# Set up the parameters for the download
params = {"id": file_id, "export": export, "confirm": confirm, "uuid": uuid}
query_string = "&".join(f"{key}={value}" for key, value in params.items())

# Make the request and download the file using the params harvested earlier
response = requests.get("https://drive.usercontent.google.com/download", params=params, stream=True, timeout=self.DEFAULT_TIMEOUT)
response = requests.get(_GOOGLE_DRIVE_DOWNLOAD_URL, params=params, stream=True, timeout=self.DEFAULT_TIMEOUT)
self.__logger.info("Downloading the unified CSV from %s?%s", _GOOGLE_DRIVE_DOWNLOAD_URL, query_string)

with open(self.__UNIFIED_CSV_FILE, "wb") as file, ProgressBar(
max_value=UnknownLength, widgets=["Downloading: ", BouncingBar(), " ", DataSize(), " ", AdaptiveTransferSpeed()]
Expand Down

0 comments on commit 38d75c8

Please sign in to comment.