You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 822B

1234567891011121314151617181920212223
  1. """
  2. This module houses the GeoIP2 object, a wrapper for the MaxMind GeoIP2(R)
  3. Python API (https://geoip2.readthedocs.io/). This is an alternative to the
  4. Python GeoIP2 interface provided by MaxMind.
  5. GeoIP(R) is a registered trademark of MaxMind, Inc.
  6. For IP-based geolocation, this module requires the GeoLite2 Country and City
  7. datasets, in binary format (CSV will not work!). The datasets may be
  8. downloaded from MaxMind at http://dev.maxmind.com/geoip/geoip2/geolite2/.
  9. Grab GeoLite2-Country.mmdb.gz and GeoLite2-City.mmdb.gz, and unzip them in the
  10. directory corresponding to settings.GEOIP_PATH.
  11. """
  12. __all__ = ['HAS_GEOIP2']
  13. try:
  14. import geoip2 # NOQA
  15. except ImportError:
  16. HAS_GEOIP2 = False
  17. else:
  18. from .base import GeoIP2, GeoIP2Exception
  19. HAS_GEOIP2 = True
  20. __all__ += ['GeoIP2', 'GeoIP2Exception']