def get_signed_url(url, config_map):
<EOL>def rsa_signer(message):<EOL><INDENT>private_key = open(config_map['<STR_LIT>'], '<STR_LIT:r>').read()<EOL>return rsa.sign(<EOL>message,<EOL>rsa.PrivateKey.load_pkcs1(private_key.encode('<STR_LIT:utf8>')),<EOL>'<STR_LIT>')  <EOL><DEDENT>if any(config_map[key] == '<STR_LIT>' for key in ['<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>']):<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>expires = datetime.datetime.utcnow() + datetime.timedelta(days=<NUM_LIT:7>)<EOL>s3_bucket = config_map['<STR_LIT>']<EOL>url = url.replace(s3_bucket + '<STR_LIT>', config_map['<STR_LIT>'])<EOL>if not AWS_CLIENT.is_aws_cf_client_set():<EOL><INDENT>cf_signer = CloudFrontSigner(<EOL>config_map['<STR_LIT>'],<EOL>rsa_signer<EOL>)<EOL>AWS_CLIENT.set_aws_cf_client(cf_signer)<EOL><DEDENT>else:<EOL><INDENT>cf_signer = AWS_CLIENT.cf<EOL><DEDENT>signed_url = cf_signer.generate_presigned_url(<EOL>url,<EOL>date_less_than=expires)<EOL>return signed_url<EOL>
Convenience function for getting cloudfront signed URL given a saved URL

    cjshaw, Jan 7, 2015

    Follows:
        http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/
            private-content-creating-signed-url-canned-policy.html#private-
            content-creating-signed-url-canned-policy-procedure
        http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/
            PrivateContent.html
        http://boto.readthedocs.org/en/latest/ref/cloudfront.html

    May 25, 2017: Switch to boto3