3 گa @ sH d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl Z ej rbddlmZ G d d d e ZG dd deZG d d dejZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd d eZG d!d" d"eZG d#d$ d$eZdS )%zACME errors. N)Any)List)Mapping)Set)errors)messagesc @ s e Zd ZdZdS )ErrorzGeneric ACME error.N)__name__ __module____qualname____doc__ r r /usr/lib/python3.6/errors.pyr s r c @ s e Zd ZdZdS )DependencyErrorzDependency errorN)r r r r r r r r r s r c @ s e Zd ZdZdS )SchemaValidationErrorz)JSON schema ACME object validation error.N)r r r r r r r r r s r c @ s e Zd ZdZdS )ClientErrorzNetwork error.N)r r r r r r r r r s r c @ s e Zd ZdZdS )UnexpectedUpdatezUnexpected update error.N)r r r r r r r r r ! s r c @ s e Zd ZdZdS ) NonceErrorzServer response nonce error.N)r r r r r r r r r % s r c s: e Zd ZdZeeedd fddZedddZ Z S ) BadNoncezBad nonce error.N)nonceerrorargsreturnc s t j| || _|| _d S )N)super__init__r r )selfr r r ) __class__r r r + s zBadNonce.__init__)r c C s dj | j| jS )NzInvalid nonce ({0!r}): {1})formatr r )r r r r __str__0 s zBadNonce.__str__) r r r r str Exceptionr r r __classcell__r r )r r r ) s r c s: e Zd ZdZejedd fddZedddZ Z S ) MissingNoncezMissing nonce error. According to the specification an "ACME server MUST include an Replay-Nonce header field in each successful response to a POST it provides to a client (...)". :ivar requests.Response ~.response: HTTP Response N)responser r c s t j| || _d S )N)r r r# )r r# r )r r r r > s zMissingNonce.__init__)r c C s dj | jjj| jjS )Nz_Server {0} response did not include a replay nonce, headers: {1} (This may be a service outage))r r# ZrequestmethodZheaders)r r r r r B s zMissingNonce.__str__)r r r r requestsZResponser r r r r! r r )r r r" 4 s r" c sR e Zd ZdZed ed dd fddZeeddd Z e dd dZ ZS ) PollErrora Generic error when polling for authorization fails. This might be caused by either timeout (`exhausted` will be non-empty) or by some authorization being invalid. :ivar exhausted: Set of `.AuthorizationResource` that didn't finish within max allowed attempts. :ivar updated: Mapping from original `.AuthorizationResource` to the most recently updated one messages.AuthorizationResourceN) exhaustedupdatedr c s || _ || _t j d S )N)r( r) r r )r r( r) )r r r r T s zPollError.__init__)r c C s t | jS )z Was the error caused by timeout?)boolr( )r r r r timeout\ s zPollError.timeoutc C s dj | jj| j| jS )Nz#{0}(exhausted={1!r}, updated={2!r}))r r r r( r) )r r r r __repr__a s zPollError.__repr__)r' r' ) r r r r r r r propertyr* r+ r r, r! r r )r r r&