def index()

in sample-demo-flask-app/flaskr/blog.py [0:0]


def index():
    """
    Creates a boto3 client and uploads a file to intentionally mimic some network behaviour.
    """
    db = get_db()
    posts = db.execute(
        'SELECT p.id, title, body, created, author_id, username'
        ' FROM post p JOIN user u ON p.author_id = u.id'
        ' ORDER BY created DESC'
    ).fetchall()
    s3_client = boto3.client('s3')
    s3_client.upload_file(s3_key_name, s3_bucket_name, s3_key_name)
    return render_template('blog/index.html', posts=posts)