Since the new update of azure-storage-blob, the blockblobservice is depreciated
How can I check that a blob exist ?
This answer is not working with the new version of azure-storage-blob Faster Azure blob name search with python?
I found this issue on GitHub : https://github.com/Azure/azure-sdk-for-python/issues/12744
Version 12.5.0 released on 2020-09-10 has now the exists method in the new SDK.
For example,
Sync:
from azure.storage.blob import BlobClient
blob = BlobClient.from_connection_string(conn_str="my_connection_string", container_name="mycontainer", blob_name="myblob")
exists = blob.exists()
print(exists)
Async:
import asyncio
async def check():
from azure.storage.blob.aio import BlobClient
blob = BlobClient.from_connection_string(conn_str="my_connection_string", container_name="mycontainer", blob_name="myblob")
async with blob:
exists = await blob.exists()
print(exists)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With