I have a container named test in azure storage. I want to generate URL for this. File directory inside it looks like below:
test
-> annotate # This is a dir
-> file1.txt
-> file2.txt
-> images # This is a dir
-> file1.jpg
-> file2.jpg
I want to generate URL so that when it is accessed I can download the complete container test including all the files and directories inside it. Now I have done this before but in that approach I was only downloading the blob using below code:
account_name = "deeusblobstorage"
container_name = "rperodct"
blob_name = "face_1_7285.jpg"
account_key = "hMlIRXCjAomfDRfied8Y5FPwTVnWEkEDuVsw//CQtkiOdcFD/y5wUcxH9Ou7Ni+DtDQFwe23YbZ3Qia9gw=="
url = f"https://{account_name}.blob.core.windows.net/{container_name}/{blob_name}"
sas_token = generate_blob_sas(
account_name=account_name,
account_key=account_key,
container_name=container_name,
blob_name=blob_name,
permission=AccountSasPermissions(read=True),
expiry=datetime.datetime.utcnow() + timedelta(hours=1)
)
url_with_sas = f"{url}?{sas_token}"
print(url_with_sas)
In the above code I was specifically mentioning the blob inside the container to download, which then generates url. But how can we generate url for a container so that all the files and directories inside it can also be downloaded. Thanks