# -*- coding: utf-8 -*-

##############################################################################################
#                  This file is deprecated because Python 2.x is deprecated                  #
#                     A Python 3.x version of this file can be found at:                     #
#                                                                                            #
# https://github.com/Guymer/PyGuymer3/blob/master/download.py                                #
##############################################################################################

def download(sess, method, url):
    # Import modules ...
    import requests

    # Try to download the URL and catch common errors ...
    try:
        resp = sess.request(method, url, timeout = 10.0)
    except requests.exceptions.TooManyRedirects:
        return False
    except requests.exceptions.ConnectionError:
        return False
    except requests.exceptions.Timeout:
        return False

    # Exit if the response was bad ...
    if resp.status_code != 200:
        return False

    return resp
