z]cj@sdZddlZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z m Z mZmZmZmZmZmZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lm Z ddl!m"Z"m#Z#ddl!m$Z$ddl!m%Z%ddl&m'Z'ddl&m(Z(ddl&m)Z)ddl&Z&ddl*Z&ej+e,Z-e.Z/e.Z0ej1dZ2ej1dZ3idd6Z4dZ5dZ6dZ7dZ8dZ9dZ:dZ;dZ<d Z=d!Z>d"Z?d#Z@d$ZAd%ZBd&ZCd'd(ZDd)ZEd*ZFd+ZGd,e.fd-YZHd.ZId/ZJd0ZKd1ZLd2ZMd3ZNd4ZOd5ZPd6ZQd7ZRd8ZSd9ZTd:ZUd;ZVd<ZWd=ZXd>ZYd?ZZd@Z[dAZ\dBZ]dCZ^dDZ_dEZ`dFZadGZbdHZcdIZddJZedKZfdLZgdMe.fdNYZhdOe.fdPYZidQe.fdRYZjdSZkdTe5fdUeidVfdWefe0fdXefe0fdYefdZefd[e_fd\eQfd]e9fd^e<fd_eSfd`e:fdaeAfdbeafdceafddeafdee=fdfe=fdge=fdhe=fdie=fdje=fdke@fdle@fdme@fdne@fdoe@fdpe@fdqe@fdre@fdse@fdte@fdue=fdve=fdwe=fdxeJfdyeJfdxeVfdXeVfdzeVfd{eIfd|eIfd}eGfd~eYfdeZfde[fde[fdeOfde^fde6e/fde6e/fde6e/fdeFfdeFfdeFfdeFfdeFfdeFfde8fdeBfdeBfdXeBfdxeBfdxeCfdzeBfdWeBfdyeBfdyeCfdeTfdeTfdeWfdeXfdebfdecfdedfde`fdeddjlfdedjlfdedjlfde\fde]fdeUdfdeUdfdedjlfdedjlfdedjlfdedjlfdeUdfdedddddddddddddddg jmfdefdePfdePfdePfdePfdedjlfdedjlfdedjlfdedjlfdePfdePfdedjlfdedjlfdejdjnfdeHdjofdekfgiZpegepdS(s_Builtin event handlers. This module contains builtin handlers for events emitted by botocore. iN( tunquotetjsontsixt unquote_strt ensure_bytestget_md5t MD5_AVAILABLEt OrderedDictturlsplitt urlunsplit(tAutoPopulatedParam(tHideParamFromOperations(tAppendParamDocumentation(tadd_generate_presigned_url(tadd_generate_presigned_post(tadd_generate_db_auth_token(tParamValidationError(tAliasConflictParameterError(tUnsupportedTLSVersionWarning(tMissingServiceIdError(tpercent_encodet SAFE_CHARS(tswitch_host_with_param(thyphenize_service_id(t retryhandler(tutils(t translates^[a-zA-Z0-9.\-_]{1,255}$s\?versionId=[^\s]+$ssagemaker-runtimesruntime.sagemakercKstj||S(N(tSERVICE_NAME_ALIASEStget(t service_nametkwargs((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pythandle_service_name_aliasCscKsH|dkrdS|\}}t|rDtjd|d|_ndS(NsWError found for response with 200 status code, errors: %s, changing status code to 500.i(tNonet_looks_like_special_case_errortloggertdebugt status_code(tresponseRt http_responsetparsed((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pytcheck_for_200_errorGs    cCso|jdkrktjjjdtjjjdd}|j|j|j}|j dkrkt Snt S(Nittargettencodingsutf-8tError( R$txmltetreet cElementTreet XMLParsert TreeBuildertfeedtcontenttclosettagtTruetFalse(R&tparsertroot((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pyR!cs  cKsw|jd}|sdS|dkr,tjS|jdrsd}|dkrVd}n|dkrot|dtRr(ttellRtitertupdatetseekRl(Rptstart_positionRntchunk((Rps3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pyRfs    cKstrt||ndS(s1Only add a Content-MD5 if the system supports it.N(RRk(RVRBtrequest_signerR((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pytconditionally_calculate_md5scKsXd|krdS|d}tj|dkrTd|tjf}td|ndS(NtBuckets?Invalid bucket name "%s": Bucket name must match the regex "%s"treport(t VALID_BUCKETtsearchR tpatternR(RVRtbuckett error_msg((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pytvalidate_bucket_names  cKst|ddS(s S3 server-side encryption requires the encryption key to be sent to the server base64 encoded, as well as a base64-encoded MD5 hash of the encryption key. This handler does both if the MD5 has not been set by the caller. t SSECustomerN(t_sse_md5(RVR((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pytsse_md5scKst|ddS(s1 S3 server-side encryption requires the encryption key to be sent to the server base64 encoded, as well as a base64-encoded MD5 hash of the encryption key. This handler does both if the MD5 has not been set by the caller specifically if the parameter is for the copy-source sse-c key. tCopySourceSSECustomerN(R(RVR((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pytcopy_source_sse_md5sRcCst||sdS|d}|d}||}t|tjrU|jd}ntjt|jj d}tj|j d}|||<||| %s(RR(t input_shapeRRRRXtsplitR"R#(RVRWRRRXRRt orig_value((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pytfix_route53_ids s    cKs&|jddkr"d|dscKs7|djdddkr3|}d|ddtj|}n|j}d|krrtj|dt|d`_. But if you prefer, you can also use botocore.utils.calculate_tree_hash() to compute it from raw file by:: checksum = calculate_tree_hash(open('your_file.txt', 'rb')) tchecksum(R R(tdoc((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pyt#document_glacier_tree_hash_checksumjs cKsd|krD|jd}|jd}|j|jdnSd|kr|jd}|jd}|jd}|j|jdndS( Nsresponse-paramsR\s param-types (*dict*) --sresponse-examplesstructure-values member-values{}(RRR(RRRttemplate_body_sectionRRRR((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pyt0document_cloudformation_get_template_return_type{s    cKst|ddS(NtPredictEndpoint(R(trequestR((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pytswitch_host_machinelearningscKsWddl}y3|j}|dkr>tjd|jtnWntk rRnXdS(NiiisCurrently installed openssl version: %s does not support TLS 1.2, which is required for use of iot-data. Please use python installed with openssl version 1.0.1 or higher.(iii(tssltOPENSSL_VERSION_INFOtwarningstwarntOPENSSL_VERSIONRRO(RRtopenssl_version_tuple((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pyt&check_openssl_supports_tls_version_1_2s    cKs\|jdkrXd|jkrXd|jdRr(RtnetlocRtjointschemetpathtqueryR (RRtprefixturl_componentstpartst new_netloctnew_componentsRf((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pyRcls    (RRt__doc__RRgRc(((s3/tmp/pip-build-kBFYxq/botocore/botocore/handlers.pyR`Xs  cKs%|js dS|jj|dds       F        !                               1 $