A fast, in-memory GeoIP data lookup module
Project description
FastGeo
A fast, flexible, in-memory GeoIP lookup library.
By default FastGeo will use the GeoLite country database, distributed free by MaxMind. It contains IP ranges and the countries they’re assigned to. The library can easily be extended (and will be later) to use the GeoLite database to also contain city and lat/lon data.
Usage
` from FastGeo import GeoDB geo = GeoDB() node = geo.lookup("173.194.43.8") print node.country_code # "US" print node.country_name # "United States" `
Note: It is recommended that the GeoDB object be instantiated at startup and not on demand as it can take a few seconds to load and parse the database file.
The GeoDB constructor will accept the path to a CSV file, although it defaults to the file distributed with the library.
The default parser assumes the following csv format: “<ip lower bound>”,”<ip upper bound>”,”<long lower bound>”,”<long upper bound>”,”<country code>”,”<country name>”
To parse other formats, inherit from FastGeo.parsers.DbParser and implement .parse(), .create_node(), and .create_value(). To use the parser, pass a new instance to the GeoDB constructor.
This product includes GeoLite data created by MaxMind, available from <a href=”http://www.maxmind.com”>http://www.maxmind.com</a>.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file FastGeo-0.1.1_alpha-py2.7.egg
.
File metadata
- Download URL: FastGeo-0.1.1_alpha-py2.7.egg
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0cbc32ca8ab262e86e62155d440a7922c7ed91b27eb3a66746a64cfd2c17f91 |
|
MD5 | e6af1aac5951489a79412d3ba81a689d |
|
BLAKE2b-256 | b5bec764fbe723b8e9f55bfb4981e7370c1b41dc70a3b4edb8d0b8539d6b5b55 |