import httplib2

def url_exists(url):
    """Check that a url- when following redirection - exists.

    This is needed because django's validators rely on python's urllib2
    which in verions < 2.6 won't follow redirects.

    """
    h = httplib2.Http()
    try:
        resp, content = h.request(url, method="HEAD")
    except httplib2.ServerNotFoundError:
        return False
    h.follow_all_redirects = True
    return 200 <= resp.status < 400

import requests

def url_exists(url):
    """Check that a url (when following redirection) exists.

    This is needed because Django's validators rely on Python's urllib2
    which in verions < 2.6 won't follow redirects.

    """
    try:
        return 200 <= requests.head(url).status_code < 400
    except requests.ConnectionError:
        return False

Switch to requests for checking if links are valid.
Switch to requests for checking if links are valid.

This should have the side effect of not caring about invalid SSL certs, for
https://unisubs.sifterapp.com/projects/12298/issues/557501/comments
