INNER CODE UNIT · Python

grab_checksums_file

kblin/ncbi-genome-download · ncbi_genome_download/core.py:531

def grab_checksums_file(entry):
    """Grab the checksum file for a given entry."""
    http_url = convert_ftp_url(entry['ftp_path'])
    full_url = '{}/md5checksums.txt'.format(http_url)
    req = requests.get(full_url)
    # download failed, just try again
    if not req.ok:
        req = requests.get(full_url)

    if req.ok:
        return req.text

    logging.error("Failed to download %s: %s", full_url, req.status_code)
    return None


def convert_ftp_url(url):
    """Convert FTP to HTTPS URLs."""

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…