a
     ÑOcñ	  ã                   @   s�   d Z ddlZddlmZmZ G dd„ deƒZG dd„ deƒZG dd	„ d	eƒZG d
d„ deƒZ	G dd„ deƒZ
G dd„ deƒZG dd„ deƒZdS )z
Errors
======

é    N)ÚOptionalÚUnionc                   @   s   e Zd ZdZdS )ÚGeoIP2Errorz¨There was a generic error in GeoIP2.

    This class represents a generic error. It extends :py:exc:`RuntimeError`
    and does not add any additional attributes.

    N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r
   r
   úD/var/www/html/gsl.tools/lib/python3.9/site-packages/geoip2/errors.pyr      s   r   c                       sr   e Zd ZU dZee ed< ee ed< deee ee ddœ‡ fdd„Ze	ee
ejejf  dœd	d
„ƒZ‡  ZS )ÚAddressNotFoundErroraÎ  The address you were looking up was not found.

    .. attribute:: ip_address

      The IP address used in the lookup. This is only available for database
      lookups.

      :type: str

    .. attribute:: network

      The network associated with the error. In particular, this is the
      largest network where no address would be found. This is only
      available for database lookups.

      :type: ipaddress.IPv4Network or ipaddress.IPv6Network

    Ú
ip_addressÚ_prefix_lenN)Úmessager   Ú
prefix_lenÚreturnc                    s   t ƒ  |¡ || _|| _d S ©N)ÚsuperÚ__init__r   r   )Úselfr   r   r   ©Ú	__class__r
   r   r   ,   s    zAddressNotFoundError.__init__)r   c                 C   s2   | j du s| jdu rdS t | j › d| j› �d¡S )zThe network for the errorNú/F)r   r   Ú	ipaddressÚ
ip_network)r   r
   r
   r   Únetwork6   s    zAddressNotFoundError.network)NN)r   r   r   r	   r   ÚstrÚ__annotations__Úintr   Úpropertyr   r   ÚIPv4NetworkÚIPv6Networkr   Ú__classcell__r
   r
   r   r   r      s   
  üû
r   c                   @   s   e Zd ZdZdS )ÚAuthenticationErrorz/There was a problem authenticating the request.Nr   r
   r
   r
   r   r#   ?   s   r#   c                       s<   e Zd ZdZdeee ee ee ddœ‡ fdd„Z‡  ZS )Ú	HTTPErrora=  There was an error when making your HTTP request.

    This class represents an HTTP transport error. It extends
    :py:exc:`GeoIP2Error` and adds attributes of its own.

    :ivar http_status: The HTTP status code returned
    :ivar uri: The URI queried
    :ivar decoded_content: The decoded response content

    N)r   Úhttp_statusÚuriÚdecoded_contentr   c                    s"   t ƒ  |¡ || _|| _|| _d S r   )r   r   r%   r&   r'   )r   r   r%   r&   r'   r   r
   r   r   O   s    zHTTPError.__init__)NNN)	r   r   r   r	   r   r   r   r   r"   r
   r
   r   r   r$   C   s      ûúr$   c                   @   s   e Zd ZdZdS )ÚInvalidRequestErrorzThe request was invalid.Nr   r
   r
   r
   r   r(   \   s   r(   c                   @   s   e Zd ZdZdS )ÚOutOfQueriesErrorz5Your account is out of funds for the service queried.Nr   r
   r
   r
   r   r)   `   s   r)   c                   @   s   e Zd ZdZdS )ÚPermissionRequiredErrorz=Your account does not have permission to access this service.Nr   r
   r
   r
   r   r*   d   s   r*   )r	   r   Útypingr   r   ÚRuntimeErrorr   r   r#   r$   r(   r)   r*   r
   r
   r
   r   Ú<module>   s   	*