
    =[jr                        d Z ddlmZmZ ddlmZ  G d de          Z G d de          Z G d d	e          Z	 G d
 de          Z
 G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d  d!e          Z G d" d#e          Zd$S )%zLibrary exceptions.    )OptionalUnion)Responsec                       e Zd ZdZdS )PyiCloudExceptionzGeneric iCloud exception.N__name__
__module____qualname____doc__     [/home/thesage/.hermes/hermes-agent/venv/lib/python3.11/site-packages/pyicloud/exceptions.pyr   r      s        ####r   r   c                       e Zd ZdZdS )PyiCloudPasswordExceptionzPassword exception.Nr   r   r   r   r   r      s        r   r   c                       e Zd ZdZdS )PyiCloudServiceUnavailablezService unavailable exception.Nr   r   r   r   r   r              ((((r   r   c                       e Zd ZdZdS )TokenExceptionzToken exception.Nr   r   r   r   r   r      s        r   r   c            	       b     e Zd ZdZ	 	 ddedeeeef                  dee         ddf fdZ	 xZ
S )	PyiCloudAPIResponseExceptionziCloud response exception.Nreasoncoderesponsereturnc                     || _         || _        || _        |pd}|r	|d| dz  }||j        r|d|j         z  }t	                                          |           dS )z=Capture a normalized API error and the optional HTTP context.  ()Nz: )r   r   r   textsuper__init__)selfr   r   r   message	__class__s        r   r#   z%PyiCloudAPIResponseException.__init__   s}     "/3	,4| 	$|D|||#GHM+HM+++G!!!!!r   )NN)r	   r
   r   r   strr   r   intr   r#   __classcell__r&   s   @r   r   r      s        $$
 +/'+	" "" uS#X'" 8$	"
 
" " " " " " " " " "r   r   c                       e Zd ZdZdS )$PyiCloudServiceNotActivatedExceptionz'iCloud service not activated exception.Nr   r   r   r   r,   r,   0   s        1111r   r,   c                   B     e Zd ZdZdddedee         ddf fdZ xZS )PyiCloudFailedLoginExceptionziCloud failed login exception.N)r   msgr   r   c                    || _         |pd}||j        r| d|j         d|j         } t                      j        |g|R   dS )z?Initialize a login failure with optional HTTP response details.zFailed login to iCloudNr   z): )r   r!   status_coder"   r#   )r$   r/   r   argsr%   r&   s        r   r#   z%PyiCloudFailedLoginException.__init__8   si     -566HM LLH$8LLX]LLG(4((((((r   )	r	   r
   r   r   r'   r   r   r#   r)   r*   s   @r   r.   r.   5   ss        (( (,	) ) )) 8$	)
 
) ) ) ) ) ) ) ) ) )r   r.   c                       e Zd ZdZdS )PyiCloudAcceptTermsExceptionziCloud accept terms exception.Nr   r   r   r   r4   r4   F   r   r   r4   c                   0     e Zd ZdZdededdf fdZ xZS )PyiCloud2FARequiredExceptionziCloud 2FA required exception.apple_idr   r   Nc                 d    d| d}t                                          |           || _        dS )z<Initialize a 2FA-required error for an HSA2 login challenge.z)2FA authentication required for account: z (HSA2)Nr"   r#   r   r$   r7   r   r%   r&   s       r   r#   z%PyiCloud2FARequiredException.__init__M   s6    T8TTT!!!"*r   r	   r
   r   r   r'   r   r#   r)   r*   s   @r   r6   r6   J   sX        ((+ + +T + + + + + + + + + +r   r6   c                   ,     e Zd ZdZdeddf fdZ xZS )PyiCloud2SARequiredExceptionziCloud 2SA required exception.r7   r   Nc                 T    d| }t                                          |           dS )z=Initialize a 2SA-required error for a legacy login challenge.z.Two-step authentication required for account: N)r"   r#   )r$   r7   r%   r&   s      r   r#   z%PyiCloud2SARequiredException.__init__W   s.    RRR!!!!!r   )r	   r
   r   r   r'   r#   r)   r*   s   @r   r=   r=   T   sQ        ((" " " " " " " " " " " "r   r=   c                   0     e Zd ZdZdededdf fdZ xZS )PyiCloudAuthRequiredExceptionz,iCloud re-authentication required exception.r7   r   r   Nc                 b    d| }t                                          |           || _        dS )zJInitialize a reauthentication-required error with the triggering response.z(Re-authentication required for account: Nr9   r:   s       r   r#   z&PyiCloudAuthRequiredException.__init__`   s3    L(LL!!!"*r   r;   r*   s   @r   r@   r@   ]   sX        66+ + +T + + + + + + + + + +r   r@   c                       e Zd ZdZdS ) PyiCloudNoTrustedNumberAvailablez#iCloud no trusted number exception.Nr   r   r   r   rC   rC   g   s        ----r   rC   c                       e Zd ZdZdS )$PyiCloudTrustedDevicePromptExceptionz*Trusted-device prompt bootstrap exception.Nr   r   r   r   rE   rE   k   s        4444r   rE   c                       e Zd ZdZdS )*PyiCloudTrustedDeviceVerificationExceptionz-Trusted-device bridge verification exception.Nr   r   r   r   rG   rG   o   s        7777r   rG   c                       e Zd ZdZdS )*PyiCloudNoStoredPasswordAvailableExceptionz$iCloud no stored password exception.Nr   r   r   r   rI   rI   s   s        ....r   rI   c                       e Zd ZdZdS )PyiCloudNoDevicesExceptionziCloud no device exception.Nr   r   r   r   rK   rK   x   s        %%%%r   rK   N)r   typingr   r   requestsr   	Exceptionr   r   r   r   r   r,   r.   r4   r6   r=   r@   rC   rE   rG   rI   rK   r   r   r   <module>rO      s     " " " " " " " "      $ $ $ $ $	 $ $ $     1   ) ) ) ) )!2 ) ) )    &   
" " " " "#4 " " ".2 2 2 2 2+G 2 2 2
) ) ) ) )#4 ) ) )") ) ) ) )#4 ) ) )+ + + + +#4 + + +" " " " "#4 " " "+ + + + +$5 + + +. . . . .'8 . . .5 5 5 5 5+G 5 5 58 8 8 8 81M 8 8 8/ / / / /1B / / /
& & & & &!2 & & & & &r   