Python 2.5 or 3.4 version onwards
GeoIP C Library 1.4.8 or greater
pip install python-geoip
If you want the free MaxMind Geolite2 database then
pip install python-geoip-geolite2
Application programming interface (API):
it is used to open a given database
it is used to Provides access to a GeoIP database
it is used to close database.The whole object can also be used as a context manager. Databases that are packaged up do not need to be closed.
Returns an info object about the database. This can be used to check for the build date of the database or what provides the GeoIP data.
- 5. get_metadata():
- Return the metadata dictionary of the loaded database. This dictionary is specific to the database provider.
- 6. class geoip.IPInfo(ip, data):
- Provides information about the located IP as returned by Database.lookup().
The most prevalent application of GeoIP involves geo-targeting, or determining a computer's location in order to tailor content specifically for that location.
Geo-targeting is most often used for targeted advertising, statistical research, spam prevention, and for restricting access based on location.
The way the IP-based geolocation works is simply by checking which IP range is used by which area, using an IP-to-location database.Once they connect to your site you already know their IP address,so just by using the Users Insights Geolocation module, you can find their location.