3 گa@sHdZddlZddlmZddlmZddlmZddlmZddlmZddl Z ej rbddl m Z Gd d d e ZGd d d eZGd ddejZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdd d eZGd!d"d"eZGd#d$d$eZdS)%z ACME errors.N)Any)List)Mapping)Set)errors)messagesc@seZdZdZdS)ErrorzGeneric ACME error.N)__name__ __module__ __qualname____doc__r r /usr/lib/python3.6/errors.pyrsrc@seZdZdZdS)DependencyErrorzDependency errorN)r r r r r r r rrsrc@seZdZdZdS)SchemaValidationErrorz)JSON schema ACME object validation error.N)r r r r r r r rrsrc@seZdZdZdS) ClientErrorzNetwork error.N)r r r r r r r rrsrc@seZdZdZdS)UnexpectedUpdatezUnexpected update error.N)r r r r r r r rr!src@seZdZdZdS) NonceErrorzServer response nonce error.N)r r r r r r r rr%srcs:eZdZdZeeeddfdd ZedddZZ S) BadNoncezBad nonce error.N)nonceerrorargsreturncstj|||_||_dS)N)super__init__rr)selfrrr) __class__r rr+s zBadNonce.__init__)rcCsdj|j|jS)NzInvalid nonce ({0!r}): {1})formatrr)rr r r__str__0szBadNonce.__str__) r r r r str Exceptionrrr __classcell__r r )rrr)srcs:eZdZdZejeddfdd ZedddZ 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)responserrcstj|||_dS)N)rrr#)rr#r)rr rr>s zMissingNonce.__init__)rcCsdj|jjj|jjS)Nz_Server {0} response did not include a replay nonce, headers: {1} (This may be a service outage))rr#ZrequestmethodZheaders)rr r rrBszMissingNonce.__str__) r r r r requestsZResponserrrrr!r r )rrr"4s r"csReZdZdZeded ddfdd Zeeddd Z e dd d Z Z 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 messages.AuthorizationResourceN) exhaustedupdatedrcs||_||_tjdS)N)r(r)rr)rr(r))rr rrTszPollError.__init__)rcCs t|jS)z Was the error caused by timeout?)boolr()rr r rtimeout\szPollError.timeoutcCsdj|jj|j|jS)Nz#{0}(exhausted={1!r}, updated={2!r}))rrr r(r))rr r r__repr__aszPollError.__repr__)r'r') r r r r rrrpropertyr*r+rr,r!r r )rrr&Hs r&cs,eZdZdZedddfdd ZZS)ValidationErrorzError for authorization failures. Contains a list of authorization resources, each of which is invalid and should have an error field. zmessages.AuthorizationResourceN)failed_authzrsrcs||_tjdS)N)r/rr)rr/)rr rrjszValidationError.__init__)r r r r rrr!r r )rrr.fsr.c@seZdZdZdS) TimeoutErrorz>Error for when polling an authorization or an order times out.N)r r r r r r r rr0osr0cs(eZdZdZdddfdd ZZS) IssuanceErrorzDError sent by the server after requesting issuance of a certificate.zmessages.ErrorN)rrcs||_tjdS)z\Initialize. :param messages.Error error: The error provided by the server. N)rrr)rr)rr rrvszIssuanceError.__init__)r r r r rr!r r )rrr1ssr1cs(eZdZdZeddfdd ZZS) 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. N)locationrcs||_tjdS)N)r3rr)rr3)rr rrszConflictError.__init__)r r r r rrr!r r )rrr2sr2c@seZdZdZdS)WildcardUnsupportedErrorzEError for when a wildcard is requested but is unsupported by ACME CA.N)r r r r r r r rr4sr4)r ZtypingrrrrZjosepyrZ jose_errorsr%Z TYPE_CHECKINGZacmerr rrZDeserializationErrorrrrrrr"r&r.r0r1r2r4r r r rs.