ó !»3Xc@@s ddlmZddlZddlZddlZddlZddlZddlZddlZ ddl Z ddl Z ddl Z ddlZddljjZddlmZmZmZmZddlmZdefd„ƒYZd„Zd„Zd „ZdS( i(tabsolute_importN(t ClientErrort ServerErrortServiceInitErrort TimeoutError(tRegionConfigurableMixint BaseServicecB@sãeZdZdZdZdZdZdZdZ gZ dddd„Z e d„ƒZ d„Zed„ƒZd„Zdddddddd „Zdddddddd „Zd „Zd „Zd „Zd„Zd„ZRS(tiicK@s||_||_d|_tj|jjƒ|_|dk rN||j_ n||_ d|_ i|_ ||_ d|_dS(N(targstconfigtNonetendpointtloggingt getLoggert __class__t__name__tlogtlevelt max_retriest region_namet session_argsttimeoutt_session(tselfR tloglevelRRtkwargs((s:/usr/lib/python2.7/site-packages/requestbuilder/service.pyt__init__0s        cK@sž|jd|jjƒ|jd|jƒ|jdt|jƒƒ|jd|jƒd|jkr~|jd|jdƒn||j|}|j ƒ|S(NRRRRtregion( t setdefaultRRRtdictRRRR t configure(tclstotherRtnew((s:/usr/lib/python2.7/site-packages/requestbuilder/service.pyt from_other>s cC@s)|jƒ|jƒ|jdkrb|jjdƒ}|dk rSt|ƒ|_qb|j|_n|jdkr°|jjdƒ}|dk r¡t |ƒ|_q°|j |_n|j j dt ƒ|jjdƒ}|dkrö|jjdƒ}n|j j d|jj|dtƒƒ|jƒdS(Ns max-retriesRtstreams verify-tlss verify-ssltverifytdefault(tupdate_config_viewt _BaseService__configure_endpointRR R tget_global_optiontintt MAX_RETRIESRtfloattTIMEOUTRRtTruetget_region_optiontconvert_to_booltFalsetvalidate_config(Rtconfig_max_retriestconfig_timeoutt verify_ssl((s:/usr/lib/python2.7/site-packages/requestbuilder/service.pyRJs&      cC@s„|jdkr}tjƒ|_x3tj|jƒD]\}}t|j||ƒq1Wx&|jjj ƒD]}d|_ qgWn|jS(Ni( RR trequeststsessiontsixt iteritemsRtsetattrtadapterstvaluesR(Rtkeytvaltadapter((s:/usr/lib/python2.7/site-packages/requestbuilder/service.pyR6lscC@s¬|jdkr¨|jdk r“dj|jƒ}|jj|ƒ}t|ƒdkr{dj|jdjt|ƒƒƒ}q™dj|j|ƒ}nd}t |ƒ‚ndS(Ns{0}-urlisWNo {0} endpoint to connect to was given. Configured regions with {0} endpoints are: {1}s, sdNo {0} endpoint to connect to was given. {0} endpoints may be specified in a config file with "{1}".s#No endpoint to connect to was given( R R tNAMEtformatR tget_all_region_optionstlentjointsortedR(Rturl_opttavailable_regionstmsg((s:/usr/lib/python2.7/site-packages/requestbuilder/service.pyR1wstGETc C@sŠ|j|ƒ}t|piƒ}dg|D]} | jƒ^q+krbtj|jƒj|dsrequest header: %s: %stkeep_blank_valuessrequest param: %s: %ss content-typeRsmultipart/form-datas!application/x-www-form-urlencodedsrequest data: %s: %st__len__s <{0} bytes>srequest file: %s: %s(*t functoolstpartialt_log_response_dataRtbind_to_serviceR R5tRequestR6tprepare_requestthooksRgRQRPRbRTRt collectionstMappingRDR7R8RLRRSRMt parse_qsltqueryR-RUtcgit parse_headertgettparse_multiparttiotBytesIOtbodyRmRVRdR@RB(RRQRPRSRURVRTRWR›t bound_authtrequestRYR<R=t content_typetcontent_type_params((s:/usr/lib/python2.7/site-packages/requestbuilder/service.pyt__log_and_prepare_requestsZ %   !     %cC@së|jjdƒr.t|jdƒ\}}n§tj|jƒrattj|jƒƒ\}}nt|jrÕ|jj|jdƒ\}}|rÌ|jj d|ƒ}|dkrÒ|j ddƒd}qÒqÕd}n||_ ||_ dS(NRPs-urltnamet:iiÿÿÿÿ(RR¢t_parse_endpoint_urltostgetenvt URL_ENVVARR?R tget_region_option2R.R trsplitR R(RRPRtsection((s:/usr/lib/python2.7/site-packages/requestbuilder/service.pyt__configure_endpointGs!    N(Rt __module__R R?t DESCRIPTIONt API_VERSIONR*R,t REGION_ENVVARR±tARGSRt classmethodR"RtpropertyR6R1RZR‰RzRxRKROR'(((s:/usr/lib/python2.7/site-packages/requestbuilder/service.pyR$s, "   ^   6cK@sÞt|jdƒrKtjjƒ|jj}|jd|j|jdƒn|jdkrp|j d|jƒn|j d|jƒt |j t tjfƒrÚx9t|j jƒƒD]\}}|jd||ƒq´WndS(NRps response time: %i.%03i secondsièisresponse status: %isresponse header: %s: %s(RdR¨RnRoRpRgtsecondst microsecondsRtterrorRjRbRTRRœRRDRm(tloggerR‚t_tdurationR<R=((s:/usr/lib/python2.7/site-packages/requestbuilder/service.pyR—]s"cc@s_|dkr[dVxGtd|ƒD]3}tjƒdd|d}t|dfƒVq!WndS(Niiii(trangetrandomtmin(R}tretry_not next_delay((s:/usr/lib/python2.7/site-packages/requestbuilder/service.pyRfks  cC@s=d|kr'|jddƒ\}}n d}|}||fS(s If given a URL, return the URL and None. If given a URL with a string and "::" prepended to it, return the URL and the prepended string. This is meant to give one a means to supply a region name via arguments and variables that normally only accept URLs. s::iN(tsplitR (turlishRRP((s:/usr/lib/python2.7/site-packages/requestbuilder/service.pyR®ss  (t __future__RR RœRnR•R¤R tos.pathR¯RÄRhtrequests.exceptionsR5R7tsix.moves.urllib_parsetmovest urllib_parseRMtrequestbuilder.exceptionsRRRRtrequestbuilder.mixinsRRR—RfR®(((s:/usr/lib/python2.7/site-packages/requestbuilder/service.pyts&           "ÿ: