M/edZddlZddlmZddlmZddlmZddlmZddlmZddl Z ejrddl m Z Gd d e ZGd d eZGd dej ZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGdd eZGd!d"eZGd#d$eZy)%z ACME errors.N)Any)List)Mapping)Set)errors)messagesceZdZdZy)ErrorzGeneric ACME error.N__name__ __module__ __qualname____doc__-/usr/lib/python3/dist-packages/acme/errors.pyr r srr ceZdZdZy)DependencyErrorzDependency errorNr rrrrrsrrceZdZdZy)SchemaValidationErrorz)JSON schema ACME object validation error.Nr rrrrrs3rrceZdZdZy) ClientErrorzNetwork error.Nr rrrrrsrrceZdZdZy)UnexpectedUpdatezUnexpected update error.Nr rrrrr!s"rrceZdZdZy) NonceErrorzServer response nonce error.Nr rrrrr%s&rrc@eZdZdZdedededdffd ZdefdZxZ S) BadNoncezBad nonce error.nonceerrorargsreturnNc:t||||_||_yN)super__init__rr )selfrr r! __class__s rr&zBadNonce.__init__+s $  rcNdj|j|jS)NzInvalid nonce ({0!r}): {1})formatrr r's r__str__zBadNonce.__str__0s+224::tzzJJr) r r rrstr Exceptionrr&r, __classcell__r(s@rrr)s5c)CD KKrrcPeZdZdZdej deddffd ZdefdZ xZ 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 responser!r"Nc,t||||_yr$)r%r&r3)r'r3r!r(s rr&zMissingNonce.__init__>s $  rcdj|jjj|jjS)Nz_Server {0} response did not include a replay nonce, headers: {1} (This may be a service outage))r*r3requestmethodheadersr+s rr,zMissingNonce.__str__Bs9EEKVMM))00$--2G2GFI Jr) r r rrrequestsResponserr&r-r,r/r0s@rr2r24s6!!2!2!3!4!JJrr2c^eZdZdZdeddedddffd Zedefd Z de fd Z xZ S) PollErroraGeneric 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 exhaustedmessages.AuthorizationResourceupdated)r>r>r"Nc>||_||_t| yr$)r=r?r%r&)r'r=r?r(s rr&zPollError.__init__Ts#  rc,t|jS)z Was the error caused by timeout?)boolr=r+s rtimeoutzPollError.timeout\sDNN##rcxdj|jj|j|jS)Nz#{0}(exhausted={1!r}, updated={2!r}))r*r(r r=r?r+s r__repr__zPollError.__repr__as04;; NN # #T^^T\\C Cr) r r rrrrr&propertyrBrCr-rEr/r0s@rr<r<Hsa #&F"G!#CD$$$C#Crr<c2eZdZdZdedddffd ZxZS)ValidationErrorzError for authorization failures. Contains a list of authorization resources, each of which is invalid and should have an error field. failed_authzrsr>r"Nc0||_t| yr$)rIr%r&)r'rIr(s rr&zValidationError.__init__js, r)r r rrrr&r/r0s@rrHrHfs't,L'MRVrrHceZdZdZy) TimeoutErrorz>Error for when polling an authorization or an order times out.Nr rrrrLrLosHrrLc$eZdZdZdfd ZxZS) IssuanceErrorzDError sent by the server after requesting issuance of a certificate.c0||_t| y)z\Initialize. :param messages.Error error: The error provided by the server. N)r r%r&)r'r r(s rr&zIssuanceError.__init__vs   r)r zmessages.Errorr"N)r r rrr&r/r0s@rrNrNssNrrNc,eZdZdZdeddffd ZxZS) ConflictErroraError for when the server returns a 409 (Conflict) HTTP status. In the version of ACME implemented by Boulder, this is used to find an account if you only have the private key, but don't know the account URL. Also used in V2 of the ACME client for the same purpose. locationr"Nc0||_t| yr$)rRr%r&)r'rRr(s rr&zConflictError.__init__s   r)r r rrr-r&r/r0s@rrQrQs rrQceZdZdZy)WildcardUnsupportedErrorzEError for when a wildcard is requested but is unsupported by ACME CA.Nr rrrrUrUsOrrU)rtypingrrrrjosepyr jose_errorsr9 TYPE_CHECKINGacmerr.r rDeserializationErrorrrrrrr2r<rHrLrNrQrUrrrr\s ( Ie4K<<4%#{#''KzKJ:J(C C<eI5I E  K PuPr