How to use ipinfo - 10 common examples

To help you get started, we’ve selected a few ipinfo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Zomboided / service.vpn.manager / libs / common.py View on Github external
def getIPInfo(addon):
    # Generate request to find out where this IP is based
    # Return ip info source, ip, location, isp
    source = addon.getSetting("ip_info_source")
    if (not source in getIPSources()):
        addon.setSetting("ip_info_source", getIPSources()[0])
        source = getIPSources()[0]    
    original_source = source
        
    if isAutoSelect(source):
        source = getAutoSource()

    retry = 0
    bad_response = False
    services_used = 1
    while retry < 6:
        debugTrace("Getting IP info from " + source)
        start_time = int(time.time())
        ip, country, region, city, isp = getIPInfoFrom(source)
        end_time = int(time.time())
        response_time = end_time - start_time
        debugTrace("Got response, IP is " + ip + ", response time in seconds is " + str(response_time))

        if ip == "no info":
            # Got a response but couldn't format it.  No point retrying, move to next service or quit
            if isAutoSelect(original_source):
github Zomboided / service.vpn.manager / libs / common.py View on Github external
ip, country, region, city, isp = getIPInfoFrom(source)
        end_time = int(time.time())
        response_time = end_time - start_time
        debugTrace("Got response, IP is " + ip + ", response time in seconds is " + str(response_time))

        if ip == "no info":
            # Got a response but couldn't format it.  No point retrying, move to next service or quit
            if isAutoSelect(original_source):
                errorTrace("common.py", "No location information was returned for IP using " + source + ", using next service")
                source = getNextSource(source)
            else:
                errorTrace("common.py", "No location information was returned for IP using " + source)
                break
        elif ip == "error" or ip == "no response":
            errorTrace("common.py", "Didn't get a good response from "  + source)
            if isAutoSelect(original_source):
                # Only want to retry if this is the first time we've seen an error (recently) otherwise
                # we assume it was broken before and it's still broken now and move to the next
                if getErrorValue(getIndex(source)) > 1:
                    source = getNextSource(source)
                    if ip == "no response": services_used += 1
                else:
                    debugTrace("Retrying "  + source + ", in 3 seconds")
                    xbmc.sleep(3000)
            else:
                # Only want to retry 2 times if it's not auto select as service is likely broken rather than busy
                if retry == 2: break                    
        else:
            # Worked, exit loop
            break
        retry = retry + 1
github Zomboided / service.vpn.manager / libs / common.py View on Github external
source = getAutoSource()

    retry = 0
    bad_response = False
    services_used = 1
    while retry < 6:
        debugTrace("Getting IP info from " + source)
        start_time = int(time.time())
        ip, country, region, city, isp = getIPInfoFrom(source)
        end_time = int(time.time())
        response_time = end_time - start_time
        debugTrace("Got response, IP is " + ip + ", response time in seconds is " + str(response_time))

        if ip == "no info":
            # Got a response but couldn't format it.  No point retrying, move to next service or quit
            if isAutoSelect(original_source):
                errorTrace("common.py", "No location information was returned for IP using " + source + ", using next service")
                source = getNextSource(source)
            else:
                errorTrace("common.py", "No location information was returned for IP using " + source)
                break
        elif ip == "error" or ip == "no response":
            errorTrace("common.py", "Didn't get a good response from "  + source)
            if isAutoSelect(original_source):
                # Only want to retry if this is the first time we've seen an error (recently) otherwise
                # we assume it was broken before and it's still broken now and move to the next
                if getErrorValue(getIndex(source)) > 1:
                    source = getNextSource(source)
                    if ip == "no response": services_used += 1
                else:
                    debugTrace("Retrying "  + source + ", in 3 seconds")
                    xbmc.sleep(3000)
github Zomboided / service.vpn.manager / libs / common.py View on Github external
def getIPInfo(addon):
    # Generate request to find out where this IP is based
    # Return ip info source, ip, location, isp
    source = addon.getSetting("ip_info_source")
    if (not source in getIPSources()):
        addon.setSetting("ip_info_source", getIPSources()[0])
        source = getIPSources()[0]    
    original_source = source
        
    if isAutoSelect(source):
        source = getAutoSource()

    retry = 0
    bad_response = False
    services_used = 1
    while retry < 6:
        debugTrace("Getting IP info from " + source)
        start_time = int(time.time())
        ip, country, region, city, isp = getIPInfoFrom(source)
        end_time = int(time.time())
        response_time = end_time - start_time
        debugTrace("Got response, IP is " + ip + ", response time in seconds is " + str(response_time))

        if ip == "no info":
            # Got a response but couldn't format it.  No point retrying, move to next service or quit
            if isAutoSelect(original_source):
                errorTrace("common.py", "No location information was returned for IP using " + source + ", using next service")
github Zomboided / service.vpn.manager / libs / common.py View on Github external
debugTrace("Got response, IP is " + ip + ", response time in seconds is " + str(response_time))

        if ip == "no info":
            # Got a response but couldn't format it.  No point retrying, move to next service or quit
            if isAutoSelect(original_source):
                errorTrace("common.py", "No location information was returned for IP using " + source + ", using next service")
                source = getNextSource(source)
            else:
                errorTrace("common.py", "No location information was returned for IP using " + source)
                break
        elif ip == "error" or ip == "no response":
            errorTrace("common.py", "Didn't get a good response from "  + source)
            if isAutoSelect(original_source):
                # Only want to retry if this is the first time we've seen an error (recently) otherwise
                # we assume it was broken before and it's still broken now and move to the next
                if getErrorValue(getIndex(source)) > 1:
                    source = getNextSource(source)
                    if ip == "no response": services_used += 1
                else:
                    debugTrace("Retrying "  + source + ", in 3 seconds")
                    xbmc.sleep(3000)
            else:
                # Only want to retry 2 times if it's not auto select as service is likely broken rather than busy
                if retry == 2: break                    
        else:
            # Worked, exit loop
            break
        retry = retry + 1
        
    # Check to see if the call was good (after 5 retries)
    if ip == "no info" or ip == "error" or ip == "no response":
        if services_used > 3:
github Zomboided / service.vpn.manager / libs / common.py View on Github external
source = addon.getSetting("ip_info_source")
    if (not source in getIPSources()):
        addon.setSetting("ip_info_source", getIPSources()[0])
        source = getIPSources()[0]    
    original_source = source
        
    if isAutoSelect(source):
        source = getAutoSource()

    retry = 0
    bad_response = False
    services_used = 1
    while retry < 6:
        debugTrace("Getting IP info from " + source)
        start_time = int(time.time())
        ip, country, region, city, isp = getIPInfoFrom(source)
        end_time = int(time.time())
        response_time = end_time - start_time
        debugTrace("Got response, IP is " + ip + ", response time in seconds is " + str(response_time))

        if ip == "no info":
            # Got a response but couldn't format it.  No point retrying, move to next service or quit
            if isAutoSelect(original_source):
                errorTrace("common.py", "No location information was returned for IP using " + source + ", using next service")
                source = getNextSource(source)
            else:
                errorTrace("common.py", "No location information was returned for IP using " + source)
                break
        elif ip == "error" or ip == "no response":
            errorTrace("common.py", "Didn't get a good response from "  + source)
            if isAutoSelect(original_source):
                # Only want to retry if this is the first time we've seen an error (recently) otherwise
github Zomboided / service.vpn.manager / libs / common.py View on Github external
def getIPInfo(addon):
    # Generate request to find out where this IP is based
    # Return ip info source, ip, location, isp
    source = addon.getSetting("ip_info_source")
    if (not source in getIPSources()):
        addon.setSetting("ip_info_source", getIPSources()[0])
        source = getIPSources()[0]    
    original_source = source
        
    if isAutoSelect(source):
        source = getAutoSource()

    retry = 0
    bad_response = False
    services_used = 1
    while retry < 6:
        debugTrace("Getting IP info from " + source)
        start_time = int(time.time())
        ip, country, region, city, isp = getIPInfoFrom(source)
        end_time = int(time.time())
        response_time = end_time - start_time
github Zomboided / service.vpn.manager / libs / common.py View on Github external
def getIPInfo(addon):
    # Generate request to find out where this IP is based
    # Return ip info source, ip, location, isp
    source = addon.getSetting("ip_info_source")
    if (not source in getIPSources()):
        addon.setSetting("ip_info_source", getIPSources()[0])
        source = getIPSources()[0]    
    original_source = source
        
    if isAutoSelect(source):
        source = getAutoSource()

    retry = 0
    bad_response = False
    services_used = 1
    while retry < 6:
        debugTrace("Getting IP info from " + source)
        start_time = int(time.time())
        ip, country, region, city, isp = getIPInfoFrom(source)
        end_time = int(time.time())
        response_time = end_time - start_time
        debugTrace("Got response, IP is " + ip + ", response time in seconds is " + str(response_time))
github Zomboided / service.vpn.manager / libs / common.py View on Github external
def getIPInfo(addon):
    # Generate request to find out where this IP is based
    # Return ip info source, ip, location, isp
    source = addon.getSetting("ip_info_source")
    if (not source in getIPSources()):
        addon.setSetting("ip_info_source", getIPSources()[0])
        source = getIPSources()[0]    
    original_source = source
        
    if isAutoSelect(source):
        source = getAutoSource()

    retry = 0
    bad_response = False
    services_used = 1
    while retry < 6:
        debugTrace("Getting IP info from " + source)
        start_time = int(time.time())
        ip, country, region, city, isp = getIPInfoFrom(source)
        end_time = int(time.time())
        response_time = end_time - start_time
        debugTrace("Got response, IP is " + ip + ", response time in seconds is " + str(response_time))
github Zomboided / service.vpn.manager / libs / common.py View on Github external
retry = 0
    bad_response = False
    services_used = 1
    while retry < 6:
        debugTrace("Getting IP info from " + source)
        start_time = int(time.time())
        ip, country, region, city, isp = getIPInfoFrom(source)
        end_time = int(time.time())
        response_time = end_time - start_time
        debugTrace("Got response, IP is " + ip + ", response time in seconds is " + str(response_time))

        if ip == "no info":
            # Got a response but couldn't format it.  No point retrying, move to next service or quit
            if isAutoSelect(original_source):
                errorTrace("common.py", "No location information was returned for IP using " + source + ", using next service")
                source = getNextSource(source)
            else:
                errorTrace("common.py", "No location information was returned for IP using " + source)
                break
        elif ip == "error" or ip == "no response":
            errorTrace("common.py", "Didn't get a good response from "  + source)
            if isAutoSelect(original_source):
                # Only want to retry if this is the first time we've seen an error (recently) otherwise
                # we assume it was broken before and it's still broken now and move to the next
                if getErrorValue(getIndex(source)) > 1:
                    source = getNextSource(source)
                    if ip == "no response": services_used += 1
                else:
                    debugTrace("Retrying "  + source + ", in 3 seconds")
                    xbmc.sleep(3000)
            else:
                # Only want to retry 2 times if it's not auto select as service is likely broken rather than busy