import logging
import requests


def request_image(image_url):
    """Attempts to download the file at the URL specified and, if available,
    returns it as a raw response object."""

    if image_url is None:
        logging.error("Image URL is None")
        return None
    logging.info(f"Downloading roll image {image_url}")
    response = requests.get(image_url, stream=True)
    if response.status_code == 200:
        response.raw.decode_content = True
        return response

    logging.error(f"Unable to download {image_url} - {response}")
    return None