| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3/dist-packages/django/contrib/gis/geoip2/__pycache__/ |
Upload File : |
�
48zj$ � �� � d dl Z d dlZd dlmZ d dlmZ d dlmZ d dl m
Z
ddlmZm
Z
eedd� � eed d
� � eedd� � d
�Z G d� de� � Z G d� d� � ZdS )� N)�settings)�ValidationError)�validate_ipv46_address)�to_path� )�City�Country�
GEOIP_PATH�
GEOIP_CITYzGeoLite2-City.mmdb�
GEOIP_COUNTRYzGeoLite2-Country.mmdb)r
r r c � � e Zd ZdS )�GeoIP2ExceptionN)�__name__�
__module__�__qualname__� � �@/usr/lib/python3/dist-packages/django/contrib/gis/geoip2/base.pyr r s � � � � � ��Dr r c � � e Zd ZdZdZdZdZdZ eeeeeef� � Z dZ
dZdZdZ
dd�Zed � � � Zed
� � � Zd� Zd� Zdd�Zd� Zd� Zd� Zd� Zdd�Zd� Zd� Zd� Zed� � � Zed� � � ZdS )�GeoIP2r r � � � � Nc �d � || j v r|| _ nt d|z � � �|pt � dd� � }|st d� � �t |� � }|� � � r�||pt � dd� � z }|� � � r:t j �
t |� � |�� � | _ || _
||pt � dd � � z }|� � � r:t j �
t |� � |�� � | _ || _ | j st d
|z � � �dS |� � � r�t j �
t |� � |�� � }|� � � j }|� d� � r|| _ || _ dS |� d� � r|| _ || _
dS t d
|z � � �t d� � �)a�
Initialize the GeoIP object. No parameters are required to use default
settings. Keyword arguments may be passed in to customize the locations
of the GeoIP datasets.
* path: Base directory to where GeoIP data is located or the full path
to where the city or country data files (*.mmdb) are located.
Assumes that both the city and country data sets are located in
this directory; overrides the GEOIP_PATH setting.
If neither is set, defaults to '/usr/share/GeoIP'.
* cache: The cache settings when opening up the GeoIP datasets. May be
an integer in (0, 1, 2, 4, 8) corresponding to the MODE_AUTO,
MODE_MMAP_EXT, MODE_MMAP, MODE_FILE, and MODE_MEMORY,
`GeoIPOptions` C API settings, respectively. Defaults to 0,
meaning MODE_AUTO.
* country: The name of the GeoIP country data file. Defaults to
'GeoLite2-Country.mmdb'; overrides the GEOIP_COUNTRY setting.
If neither is set, defaults to 'GeoIP.dat'.
* city: The name of the GeoIP city data file. Defaults to
'GeoLite2-City.mmdb'; overrides the GEOIP_CITY setting.
If neither is set, defaults to 'GeoIPCity.dat'.
z Invalid GeoIP caching option: %sr
z/usr/share/GeoIPzDGeoIP path must be provided via parameter or the GEOIP_PATH setting.r z GeoIP.dat)�moder z
GeoIPCity.datz"Could not load a database from %s.r r z(Unable to recognize database edition: %sz-GeoIP path must be a valid file or directory.N)�
cache_options�_cacher �GEOIP_SETTINGS�getr �is_dir�is_file�geoip2�database�Reader�str�_country�
_country_file�_city�
_city_file�_reader�metadata�
database_type�endswith) �self�path�cache�country�city�
country_db�city_db�reader�db_types r �__init__zGeoIP2.__init__. s# � �6 �D�&�&�&��D�K�K�!�"D�u�"L�M�M�M� �K�~�)�)�,�8J�K�K��� j�!�"h�i�i�i��t�}�}���;�;�=�=� ! S� ��!\�N�,>�,>��P[�,\�,\�]�J��!�!�#�#�
0� &�� 6� 6�s�:���U� 6� S� S��
�%/��"��d�W�n�&8�&8���&W�&W�X�G���� � �
*�#�_�3�3�C��L�L�u�3�M�M��
�")����<�
S�%�&J�T�&Q�R�R�R�
S�
S�
�\�\�^�^� S� �_�+�+�C��I�I�E�+�B�B�F��o�o�'�'�5�G�����'�'�
\�#��
�"&������!�!�)�,�,�
\� &��
�%)��"�"�"�%�&P�SZ�&Z�[�[�[�!�"Q�R�R�Rr c � � | j p| j S �N)r'