Verifica se esiste un BLOB in Python Azzurro
Sep 15 2020
Dal momento che il nuovo aggiornamento di azure-storage-blob, il servizio blockblob è stato deprecato
Come posso verificare che esista un BLOB?
Questa risposta non funziona con la nuova versione di azure-storage-blob Ricerca più veloce del nome del BLOB di Azure con Python?
Ho trovato questo problema su GitHub: https://github.com/Azure/azure-sdk-for-python/issues/12744
Risposte
4 krishg Sep 15 2020 at 04:11
La versione 12.5.0 rilasciata il 10/09/2020 ora ha il existsmetodo nel nuovo SDK.
Per esempio,
Sincronizza:
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)