I have a simple Flask Azure-webapp which I would like the user to be able to upload images. The images are then stored in an Azure Blob.
import os, uuid
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
try:
print("Azure Blob storage v12 - Python quickstart sample")
# Quick start code goes here
except Exception as ex:
print('Exception:')
print(ex)
connect_str = "XXXXX"
blob_service_client = BlobServiceClient.from_connection_string(connect_str)
container_name = 'kdprivatecontainer'
container_client = blob_service_client.get_container_client(container_name)
# List the blobs in the container
print("\nListing blobs...")
blob_list = container_client.list_blobs()
for blob in blob_list:
print("\t" + blob.name)
I can see the names of the files through this method... how do I pass the images to a front-end webpage while keeping the container as 'private'.
A total stab in the dark is: but obviously doesn't work :/
from flask import Flask, render_template
app = Flask(app)
@app.route("/showimg')
def showimage():
blobimage = blob[9].url????
return render_template('showimage.html, img=blobimage)
Any guidance is appreciated. :)