123456789101112131415 |
- def create_blob_from_path(storage_connection_string,container_name):
- try:
- # Instantiate a new BlobServiceClient and a new ContainerClient
- blob_service_client = BlobServiceClient.from_connection_string(storage_connection_string)
- container_client = blob_service_client.get_container_client(container_name)
- for f in list_files():
- with open(f["local_path"], "rb") as data:
- blob_client = container_client.get_blob_client(f["file_name"])
- blob_client.upload_blob(data,overwrite=True)
- return True
- except Exception as e:
- print(e.message, e.args)
- return False
|