def resource(target, url, post=False, **kw_args):
    'Specify a dependency on an online resource.\n\n    Further takes in keyword arguments that are passed to the appropriate method\n    from :mod:`requests` or :mod:`urllib`.\n\n    Args:\n        target (str): Target file.\n        url (str): Source URL.\n        post (bool, optional): Make a POST request instead of a GET request.\n            Only applicable if the URL starts with "http" or "https". Defaults\n            to `False`.\n    '
    if (not os.path.exists(target)):
        with wbml.out.Section('Downloading file'):
            wbml.out.kv('Source', url)
            wbml.out.kv('Target', target)
            make_dirs(target)
            if url.startswith('ftp'):
                with closing(urllib.request.urlopen(url, **kw_args)) as r:
                    with open(target, 'wb') as f:
                        shutil.copyfileobj(r, f)
            else:
                request = (requests.post if post else requests.get)
                with request(url, stream=True, **kw_args) as r:
                    with open(target, 'wb') as f:
                        shutil.copyfileobj(r.raw, f)
Specify a dependency on an online resource.

Further takes in keyword arguments that are passed to the appropriate method
from :mod:`requests` or :mod:`urllib`.

Args:
    target (str): Target file.
    url (str): Source URL.
    post (bool, optional): Make a POST request instead of a GET request.
        Only applicable if the URL starts with "http" or "https". Defaults
        to `False`.
def resource(target, url, post=False, **kw_args):
    'Specify a dependency on an online resource.\n\n    Further takes in keyword arguments that are passed to the appropriate method\n    from :mod:`requests` or :mod:`urllib`.\n\n    Args:\n        target (str): Target file.\n        url (str): Source URL.\n        post (bool, optional): Make a POST request instead of a GET request.\n            Only applicable if the URL starts with "http" or "https". Defaults\n            to `False`.\n    '
    if (not os.path.exists(target)):
        with wbml.out.Section('Downloading file'):
            wbml.out.kv('Source', url)
            wbml.out.kv('Target', target)
            make_dirs(target)
            if url.startswith('ftp'):
                with closing(urllib.request.urlopen(url, **kw_args)) as r:
                    with open(target, 'wb') as f:
                        shutil.copyfileobj(r, f)
            else:
                request = (requests.post if post else requests.get)
                with request(url, stream=True, **kw_args) as r:
                    with open(target, 'wb') as f:
                        shutil.copyfileobj(r.raw, f)