ó ôBQc@sHddlZddlZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z dd lm Z dd lm Z dd lm Z dd l mZdd lmZddlmZddlmZddlmZddlmZddlmZdZdefd„ƒYZdS(iÿÿÿÿN(tCommand(t COMMAND_NAME(tCOMMAND_NAME_ALIASES(tCONFIG_REQUIRED(t FILE_URIS_OK(tMAX_ARGS(tMIN_ARGS(tPROVIDER_URIS_OK(tSUPPORTED_SUB_ARGS(tURIS_START_ARG(tCommandException(t HELP_NAME(tHELP_NAME_ALIASES(tHELP_ONE_LINE_SUMMARY(t HELP_TEXT(tHelpType(t HELP_TYPEs SYNOPSIS gsutil getcors uri DESCRIPTION Gets the Cross-Origin Resource Sharing (CORS) configuration for a given bucket. This command is supported for buckets only, not objects and you can get the CORS settings for only one bucket at a time. The output from getcors can be redirected into a file, edited and then updated via the setcors sub-command. The CORS configuration is expressed by an XML document with the following structure: origin1.example.com GET Content-Type For more info about CORS, see http://www.w3.org/TR/cors/. tGetCorsCommandcBsˆeZdZi de6ge6de6de6de6ee 6ee 6de 6e e 6Zide6ge6eje6de6ee6Zd„ZRS(s)Implementation of gsutil getcors command.tgetcorsitis Get a bucket's CORS XML documentcCsıt|j|jdƒjƒƒ}t|ƒdkrCtdƒ‚nt|ƒdkrxtd|jd|jfƒ‚n|d}|jƒs¤td|jƒ‚n|jt |j ƒ}t j j j|jƒjdƒƒ}tjj|jddƒƒdS( NisNo URIs matchedisD%s matched more than one URI, which is not allowed by the %s commands""%s" command must specify a bucketsutf-8tindents (tlisttWildcardIteratortargstIterUristlenR t command_namet names_buckettget_corstFalsetheaderstxmltdomtminidomt parseStringtto_xmltencodetsyststdouttwritet toprettyxml(tselfturisturitcorst parsed_xml((s4/tmp/tmp.yUYbTOKr8o/gsutil/gslib/commands/getcors.pyt RunCommandis"  $(t__name__t __module__t__doc__RRRRRRRRR tTrueRt command_specR R Rt COMMAND_HELPRR t_detailed_help_textRt help_specR.(((s4/tmp/tmp.yUYbTOKr8o/gsutil/gslib/commands/getcors.pyRCs$   (R%Rt gslib.commandRRRRRRRRRR tgslib.exceptionR tgslib.help_providerR R R RRRR5R(((s4/tmp/tmp.yUYbTOKr8o/gsutil/gslib/commands/getcors.pyts(