Author: Randall Degges

How to Perform a GeoIP Lookup in Flask

If you’re building a website (or API) using Flask, it’s often useful to know where your visitors are coming from: the US, the EU, someplace else? The process of locating a web user is typically referred to IP geolocation, and unfortunately, it isn’t simple.

The reason it isn’t easy to get IP geolocation data is that there is no standard mapping of IPs -> location data. Most companies get this data by purchasing it from GeoIP aggregators that piece together lots of different bits of information to build an accurate database of IP geolocation data.

GeoIP data is typically comprised of:

How to Perform a GeoIP Lookup in Express.js

If you’re building a website (or API) using Express.js, it’s often useful to know where your visitors are coming from: the US, the EU, someplace else? The process of locating a web user is typically referred to IP geolocation, and unfortunately, it isn’t simple.

The reason it isn’t easy to get IP geolocation data is that there is no standard mapping of IPs -> location data. Most companies get this data by purchasing it from GeoIP aggregators that piece together lots of different bits of information to build an accurate database of IP geolocation data.

GeoIP data is typically comprised of:

How to Perform a GeoIP Lookup with Node.js

In this article, I’m going to walk you through the best possible way to find the physical location of an IP address using Node.js (also known as IP geolocation).

Unfortunately, there is no standard way to figure out where an IP address is physically located. Instead, companies referred to as GeoIP providers aggregate many different pieces of data together to build an accurate database of IP location data.

GeoIP data is typically comprised of:

  • Domain WHOIS data (which itself must be aggregated by data providers)
  • Regional Internet Registries, which hand out large blocks of IP addresses to various Internet Service Providers around the world (ISPs)