HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/local/bin/dhwp/dhwp/core/curl.py
import re
import sys
import os
from cement import shell
from cement.utils.misc import minimal_logger
LOG = minimal_logger(__name__)


def fetch(url, dest_path):
    out, err, code = shell.cmd('which curl')

    if code > 0:
        LOG.fatal("cannot find curl, please install it first")
        sys.exit(1)

    command = "curl -s -L -o %s %s" % (dest_path, url)

    LOG.debug("fetch command : %s" % command)
    out, err, code = shell.cmd(command)

    if code > 0:
        LOG.fatal("curl failed : (%s) (%s)" % (out, err))
        sys.exit(1)