old project, new git. welcome to echo

This commit is contained in:
Brandon4466
2023-07-01 23:39:34 -07:00
commit 64bc064557
16 changed files with 772 additions and 0 deletions

21
save_azure.py Normal file
View File

@@ -0,0 +1,21 @@
from azure.identity import DefaultAzureCredential
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
def save(path, filename):
account_url = "https://theecho.blob.core.windows.net"
default_credential = DefaultAzureCredential()
# Create the BlobServiceClient object
blob_service_client = BlobServiceClient(account_url, credential=default_credential)
container_name = "ppics"
# Create a blob client using the local file name as the name for the blob
blob_client = blob_service_client.get_blob_client(container=container_name, blob=filename)
# Upload the created file
with open(file=path, mode="rb") as data:
blob_client.upload_blob(data)
url = account_url + "/" + container_name + "/" + filename
return url