Did I find the right examples for you? yes no

All Samples(7)  |  Call(5)  |  Derive(0)  |  Import(2)

        def url_is_valid(url):
    valid_codes = [200, 301, 302]
    request = requests.get(url)

    if request.status_code in valid_codes:
        return True
    else:
        return False
        


src/d/j/django-statify-0.2.0/statify/admin.py   django-statify(Download)
# Project imports
from models import ExternalURL, URL, Release, DeploymentHost
from utils import url_is_valid
 
 
 
        # Check if url exists and
        if url_is_valid(url):
            return self.cleaned_data
        else:
def validate_urls(modeladmin, request, queryset):
    for u in queryset:
        url = u'http://%s%s' % (CURRENT_SITE, u)
 
        if url_is_valid(url):
def validate_external_urls(modeladmin, request, queryset):
    for u in queryset:
        if url_is_valid(u.url):
            u.is_valid = True
        else:
 
        # Check if url exists and
        if url_is_valid(url):
            return self.cleaned_data
        else:

src/d/j/django-statify-0.2.0/statify/signals.py   django-statify(Download)
# Project imports
from models import URL
from utils import url_is_valid
import settings as statify_settings
 
            absolute_url = u'/%s/' % (instance.language)
 
        if url_is_valid(u'http://%s%s' % (current_site, absolute_url)):
            try:
                URL(url=absolute_url).save()