o
    Ð­j„  ã                   @   sh   d dl Z ddlmZ ddlmZmZmZ ddlm	Z	 G dd„ deƒZ
G dd	„ d	eƒZG d
d„ deƒZdS )é    Né   )Údatastructures)ÚInvalidHandshakeÚInvalidMessageÚProtocolError)Ú
StatusLikec                   @   s6   e Zd ZdZdedejddfdd„Zdefdd	„Z	dS )
ÚInvalidStatusCodezC
    Raised when a handshake response status code is invalid.

    Ústatus_codeÚheadersÚreturnNc                 C   s   || _ || _d S ©N)r	   r
   )Úselfr	   r
   © r   úY/var/www/html/CropPilot/venv/lib/python3.10/site-packages/websockets/legacy/exceptions.pyÚ__init__   s   
zInvalidStatusCode.__init__c                 C   ó   d| j › �S )Nz+server rejected WebSocket connection: HTTP )r	   ©r   r   r   r   Ú__str__   ó   zInvalidStatusCode.__str__)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úintr   ÚHeadersr   Ústrr   r   r   r   r   r      s    r   c                	   @   s>   e Zd ZdZ	ddedejdeddfdd	„Zde	fd
d„Z
dS )ÚAbortHandshakeaˆ  
    Raised to abort the handshake on purpose and return an HTTP response.

    This exception is an implementation detail.

    The public API is
    :meth:`~websockets.legacy.server.WebSocketServerProtocol.process_request`.

    Attributes:
        status (~http.HTTPStatus): HTTP status code.
        headers (Headers): HTTP response headers.
        body (bytes): HTTP response body.
    ó    Ústatusr
   Úbodyr   Nc                 C   s"   t  |¡| _t |¡| _|| _d S r   )ÚhttpÚ
HTTPStatusr   r   r   r
   r   )r   r   r
   r   r   r   r   r   *   s   
zAbortHandshake.__init__c                 C   s(   d| j d›dt| jƒ› dt| jƒ› d�S )NzHTTP Údz, z
 headers, z bytes)r   Úlenr
   r   r   r   r   r   r   5   s   &ÿzAbortHandshake.__str__)r   )r   r   r   r   r   r   ÚHeadersLikeÚbytesr   r   r   r   r   r   r   r      s    üþýü
ûr   c                   @   s0   e Zd ZdZdeddfdd„Zdefdd„ZdS )	ÚRedirectHandshakezd
    Raised when a handshake gets redirected.

    This exception is an implementation detail.

    Úurir   Nc                 C   s
   || _ d S r   ©r'   )r   r'   r   r   r   r   C   s   
zRedirectHandshake.__init__c                 C   r   )Nzredirect to r(   r   r   r   r   r   F   r   zRedirectHandshake.__str__)r   r   r   r   r   r   r   r   r   r   r   r&   ;   s    r&   )r    Ú r   Ú
exceptionsr   r   r   ÚWebSocketProtocolErrorÚtypingr   r   r   r&   r   r   r   r   Ú<module>   s     