def main():
    """
        Run the whole thing
    """
    # Get the shell arguments
    args = parse_shell_parameters()

    # Transfer shell arguments to variables
    destination_file = args.output
    bucket = args.bucket
    image_key = args.key

    # Ok, all set! We can download the file ...
    log.debug('Downloading with key: "{0}" from bucket: "{1}" to output file: "{2}" '.format(image_key, bucket,
        destination_file))
    download(destination_file, image_key, bucket)

    return 0


####################################################################
#
# MAIN
#
####################################################################

if __name__ == "__main__":
    log = logger.get_logger('s3-image-download')
    config = ConfigurationHandler().read_configuration()
    main()
示例#2
0
    # Get the shell arguments
    args = parse_shell_parameters()

    # Transfer shell arguments to variables
    image_file = args.input
    bucket = args.bucket
    image_key = args.key

    # Given image file is not a valid file? Hmm, that's a problem!
    if not os.path.isfile(image_file):
        log.error("{0} is not a valid (image) file!".format(image_file))
        sys.exit("{0} is not a valid (image) file!".format(image_file))

    # Ok, all set! We can upload the file ...
    log.debug('Uploading file: "{0}" with key: "{1}" to bucket: "{2}"'.format(image_file, image_key, bucket))
    upload(image_file, image_key, bucket)

    return 0


####################################################################
#
# MAIN
#
####################################################################

if __name__ == "__main__":
    log = logger.get_logger('s3-image-upload')
    config = ConfigurationHandler().read_configuration()
    main()
    """
        Run the whole thing
    """
    # Get the shell arguments
    args = parse_shell_parameters()

    # Transfer shell arguments to variables
    destination_file = args.output
    bucket = args.bucket
    image_key = args.key

    # Ok, all set! We can download the file ...
    log.debug(
        'Downloading with key: "{0}" from bucket: "{1}" to output file: "{2}" '
        .format(image_key, bucket, destination_file))
    download(destination_file, image_key, bucket)

    return 0


####################################################################
#
# MAIN
#
####################################################################

if __name__ == "__main__":
    log = logger.get_logger('s3-image-download')
    config = ConfigurationHandler().read_configuration()
    main()
    args = parse_shell_parameters()

    # Transfer shell arguments to variables
    image_file = args.input
    bucket = args.bucket
    image_key = args.key

    # Given image file is not a valid file? Hmm, that's a problem!
    if not os.path.isfile(image_file):
        log.error("{0} is not a valid (image) file!".format(image_file))
        sys.exit("{0} is not a valid (image) file!".format(image_file))

    # Ok, all set! We can upload the file ...
    log.debug('Uploading file: "{0}" with key: "{1}" to bucket: "{2}"'.format(
        image_file, image_key, bucket))
    upload(image_file, image_key, bucket)

    return 0


####################################################################
#
# MAIN
#
####################################################################

if __name__ == "__main__":
    log = logger.get_logger('s3-image-upload')
    config = ConfigurationHandler().read_configuration()
    main()