o 6a@sHdZddlZddlmZddlmZddlmZddlmZddlmZddl Z ej r1ddl 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@eZdZdZdS)ErrorzGeneric ACME error.N__name__ __module__ __qualname____doc__rr-/usr/lib/python3/dist-packages/acme/errors.pyr r c@r)DependencyErrorzDependency errorNr rrrrrrrc@r)SchemaValidationErrorz)JSON schema ACME object validation error.Nr rrrrrrrc@r) ClientErrorzNetwork error.Nr rrrrrrrc@r)UnexpectedUpdatezUnexpected update error.Nr rrrrr!rrc@r) NonceErrorzServer response nonce error.Nr rrrrr%rrcs@eZdZdZdedededdffdd Zdefd d ZZ S) BadNoncezBad nonce error.nonceerrorargsreturnNcstj|||_||_dSN)super__init__rr)selfrrr __class__rrr+s  zBadNonce.__init__cCsd|j|jS)NzInvalid nonce ({0!r}): {1})formatrrrrrr__str__0szBadNonce.__str__) r r r rstr Exceptionrrr$ __classcell__rrr rr)srcs>eZdZdZdejdeddffdd Zdefdd Z 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 responserrNcstj|||_dSr)rrr))rr)rr rrr>s  zMissingNonce.__init__cCsd|jjj|jjS)Nz_Server {0} response did not include a replay nonce, headers: {1} (This may be a service outage))r"r)requestmethodheadersr#rrrr$Bs zMissingNonce.__str__) r r r rrequestsResponserrr%r$r'rrr rr(4s r(csVeZdZdZdeddedddffdd Zedefd d Z de fd 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 exhaustedmessages.AuthorizationResourceupdated)r1r1rNcs||_||_tdSr)r0r2rr)rr0r2r rrrTszPollError.__init__cCs t|jS)z Was the error caused by timeout?)boolr0r#rrrtimeout\s zPollError.timeoutcCsd|jj|j|jS)Nz#{0}(exhausted={1!r}, updated={2!r}))r"r!r r0r2r#rrr__repr__aszPollError.__repr__) r r r rrrrpropertyr3r4r%r5r'rrr rr/Hs r/cs.eZdZdZdedddffdd ZZS)ValidationErrorzError for authorization failures. Contains a list of authorization resources, each of which is invalid and should have an error field. failed_authzrsr1rNc||_tdSr)r8rr)rr8r rrrjzValidationError.__init__)r r r rrrr'rrr rr7fs"r7c@r) TimeoutErrorz>Error for when polling an authorization or an order times out.Nr rrrrr;orr;cs"eZdZdZdfdd ZZS) IssuanceErrorzDError sent by the server after requesting issuance of a certificate.rmessages.ErrorrNcs||_tdS)z\Initialize. :param messages.Error error: The error provided by the server. N)rrr)rrr rrrvszIssuanceError.__init__)rr=rN)r r r rrr'rrr rr<ssr<cs*eZdZdZdeddffdd 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. locationrNcr9r)r?rr)rr?r rrrr:zConflictError.__init__)r r r rr%rr'rrr rr>sr>c@r)WildcardUnsupportedErrorzEError for when a wildcard is requested but is unsupported by ACME CA.Nr rrrrr@rr@)rtypingrrrrjosepyr jose_errorsr- TYPE_CHECKINGacmerr&r rDeserializationErrorrrrrrr(r/r7r;r<r>r@rrrrs0