INNER CODE UNIT · Python
download
lefterisloukas/edgar-crawler · download_filings.py:741
def download(url: str, filename: str, download_folder: str, user_agent: str) -> bool:
"""
Downloads a file from the given URL and saves it to the specified directory.
The downloaded file will be named according to the following convention:
<CIK-KEY_YEAR_FILING-TYPE.EXTENSION_TYPE> (e.g., 1000229_2018_10K.html).
Args:
url (str): The URL of the file to download.
filename (str): The name to give to the downloaded file. This should include the file extension.
download_folder (str): The directory to save the downloaded file in.
user_agent (str): The User-Agent string to use when making the request.
Returns:
bool: True if the download was successful, False otherwise.
"""
# Create the full file path