def upload_file(source, bucket, key, s3lib, acl, cacheControl, contentType): print('uploading from {} {} {}'.format(source, bucket, key)) contentType = contentType or defaultContentType s3lib.Object(bucket, key).put(ACL=acl, Body=open(source, 'rb'), CacheControl=cacheControl, ContentType=contentType)