Question

we have a commercial maxmind-subscribtion to obtain a GeoIP-Database with ISP-information (GeioIPIPSP.dat). However, when I try to query this file, I keep getting the following error:

GeoIPError: Invalid database type, expected Org, ISP or ASNum

I'm using the python-api:

geo = GeoIP.open("/GeoIPIPSP.dat", GeoIP.GEOIP_STANDARD)
isp = geo.name_by_addr(ip) # or isp_by_addr with pygeoip

When I use the api to ask for the database-type (geo._type) I get "1" ... the same value I get when I open a regular GeoIP.dat. I'm wondering if there's something wrong with GeoIPISP.dat, but it's the most recent file from maxmind's customer-download-page.

Any insights greatly appreciated!

Was it helpful?

Solution

It turns out there was a problem with the database-file indeed. After a re-download everything works as it is supposed to.

I switched to pygeoip though and access the database like this:

import pygeoip geo_isp = pygeoip.GeoIP("/usr/share/GeoIP/GeoIPIPSP.dat") isp = geo_isp.isp_by_addr("8.8.8.8")

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top