Interactive demo | other/57-geolite2

Intro

Plots out a world map with the specified ip addresses locations
Run
Server offline
Idle

Parameters

Result

(none yet)

Sample api request

Source code

def endpoint(ipAddresses:serve.text()="10.191.7.1\n12.3.197.33\n32.142.135.73") -> serve.html():
    """Plots out a world map with the specified ip addresses locations

:param ipAddresses: a random paragraph containing ip addresses. This will pull out the first ip address of each
    line. So you can paste in the raw output of traceroute and it would still work
"""
    plt.figure(figsize=(16, 10)); plt.worldmap()
    ipAddresses.split("\n") | grep("(?P<g>\d+\.\d+.\d+.\d+)", extract="g") | apply(ip2Int) | lookupRange(ranges(), mode="fill") | filt("x") | cut(1, 0) | head(3) | T() | ~aS(plt.plot, ".")
    return plt.gcf() | toImg() | toHtml()