__init__.py 882 B

123456789101112131415161718192021
  1. """
  2. This module houses the GeoIP object, a ctypes wrapper for the MaxMind GeoIP(R)
  3. C API (http://www.maxmind.com/app/c). This is an alternative to the GPL
  4. licensed Python GeoIP interface provided by MaxMind.
  5. GeoIP(R) is a registered trademark of MaxMind, LLC of Boston, Massachusetts.
  6. For IP-based geolocation, this module requires the GeoLite Country and City
  7. datasets, in binary format (CSV will not work!). The datasets may be
  8. downloaded from MaxMind at http://www.maxmind.com/download/geoip/database/.
  9. Grab GeoIP.dat.gz and GeoLiteCity.dat.gz, and unzip them in the directory
  10. corresponding to settings.GEOIP_PATH.
  11. """
  12. __all__ = ['HAS_GEOIP']
  13. try:
  14. from .base import GeoIP, GeoIPException
  15. HAS_GEOIP = True
  16. __all__ += ['GeoIP', 'GeoIPException']
  17. except RuntimeError: # libgeoip.py raises a RuntimeError if no GeoIP library is found
  18. HAS_GEOIP = False