Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(5)  |  Call(4)  |  Derive(0)  |  Import(1)
Test if string is valid IPv4 or IPv6

        def is_valid_ip(addr):
    """Test if string is valid IPv4 or IPv6"""
    return (IPv4.isString(addr) or IPv6.isString(addr))

src/b/i/BitTornado-HEAD/BitTornado/BT1/track.py   BitTornado(Download)
import threading
from urllib import quote, unquote
from BitTornado.NetworkAddress import is_ipv4, is_valid_ip, ipv6_to_ipv4, \
    to_ipv4, AddrList
from BitTornado.parseargs import parseargs, formatDefinitions
            return header
        if is_valid_ip(x) and x not in local_IPs:
            return x
        return y
def get_forwarded_ip(headers):
    x = _get_forwarded_ip(headers)
    if not is_valid_ip(x) or x in local_IPs:
        return None
    return x
                gip = y.get('given_ip')
                if is_valid_ip(gip) and (not self.only_local_override_ip or
                                         ip in local_IPs):
                    ip = gip
        gip = params('ip')
        if is_valid_ip(gip) and (islocal or not self.only_local_override_ip):
            ip1 = gip