o ckF[eã@stddlmZddlZddlZddlZddlZddlZddlZddlm Z Gdd„dej j ƒZ Gdd„dej jƒZdS)é)Úprint_functionN)ÚawsqueryrequestcseZdZ‡fdd„Z‡ZS)ÚNoCredentialsErrorcsd}tt|ƒ |¡dS)NzUnable to find credentials)ÚsuperrÚ__init__)ÚselfÚs©Ú __class__©ú=/usr/lib/python3/dist-packages/boto/roboto/awsqueryservice.pyr szNoCredentialsError.__init__)Ú__name__Ú __module__Ú __qualname__rÚ __classcell__r r r r r srcsXeZdZdZdZdZdZdZdZdZ dZ gZ ‡fdd„Z d d „Z d d „Zd d„Z‡ZS)ÚAWSQueryServiceÚzsign-v2ú/i»ÚawsÚAWS_URLc sÎ||_| ¡| ¡d|jvr2|jr2|j d|jdd¡}|jD]}|d|kr1|d|jd<q"d|jvr=|j|jd<d|jvrH|j|jd<ztt|ƒj di|j¤Žd|_ WdSt j j yftƒ‚w) NÚhostÚ region_namerÚnameÚendpointÚpathÚportr )ÚargsÚcheck_for_credential_fileÚcheck_for_env_urlÚRegionsÚgetÚPathÚPortrrrÚ aws_responseÚbotoÚ exceptionÚNoAuthHandlerFoundr)rrrÚregionr r r rs,  ÿ  €     ÿzAWSQueryService.__init__cCsädtjvrptjd}tj |¡}tj |¡}tj |¡rjt|ƒ}| ¡}| ¡|D]=}|ddkrgd|vrg|  dd¡\}}|  ¡dkrSd|j vrR|  ¡}||j d<q*|  ¡dkrgd |j vrg|  ¡}||j d <q*d St d ƒd Sd S) aq Checks for the existence of an AWS credential file. If the environment variable AWS_CREDENTIAL_FILE is set and points to a file, that file will be read and will be searched credentials. Note that if credentials have been explicitelypassed into the class constructor, those values always take precedence. ÚAWS_CREDENTIAL_FILErú#ú=éÚAWSAccessKeyIdÚaws_access_key_idÚ AWSSecretKeyÚaws_secret_access_keyz+Warning: unable to read AWS_CREDENTIAL_FILEN) ÚosÚenvironrÚ expanduserÚ expandvarsÚisfileÚopenÚ readlinesÚcloseÚsplitÚstriprÚprint)rrÚfpÚlinesÚlinerÚvaluer r r r2s2        €   €õ ëz)AWSQueryService.check_for_credential_filecCsú|j dd¡}|r |jd=|s|jtjvrtj|j}|rwt |¡}d|jvr7|jdkr2d|jd<nd|jd<|j}d}| d¡}t |ƒdkrQ|d }t |dƒ}d |jvr[||jd <|rgd |jvrg||jd <|j ryd |jvr{|j |jd <dSdSdSdS) a¡ First checks to see if a url argument was explicitly passed in. If so, that will be used. If not, it checks for the existence of the environment variable specified in ENV_URL. If this is set, it should contain a fully qualified URL to the service you want to use. Note that any values passed explicitly to the class constructor will take precedence. ÚurlNÚ is_secureÚhttpsTFú:r+rrrr) rr ÚEnvURLr0r1ÚurlparseÚschemeÚnetlocr8ÚlenÚintr)rr?ÚrsltrrÚlr r r rSs2             ìz!AWSQueryService.check_for_env_urlcCs|jgS)N)ÚAuthentication)rr r r Ú_required_auth_capabilityxsz)AWSQueryService._required_auth_capability)r rrÚNameÚ DescriptionÚ APIVersionrKr!r"ÚProviderrCrrrrrLrr r r r rs !%r)Ú __future__rr0rDr$Úboto.connectionÚboto.jsonresponseÚboto.exceptionÚ boto.robotorr%ÚBotoClientErrorrÚ connectionÚAWSQueryConnectionrr r r r Ús