Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from azureCreds import *
import os, uuid, sys
from azure.storage.file import FileService
from azure.storage.file import ContentSettings
# generator = file_service.list_directories_and_files(share_name=CONTAINER_NAME,
# directory_name=DIRECTORY_NAME)
# for blob in generator:
# print("\t Blob name: " + blob.name)
file_name = 'face_verification.png'
full_path_to_file = r'C:\Users\bigsnarfdude\Desktop\face_verification.png'
def upload_webcam_data(file_name, full_path_to_file):
try:
file_service = FileService(account_name=ACCOUNT_NAME,
account_key=ACCOUNT_KEY,
protocol='https',
endpoint_suffix='core.windows.net', connection_string=CONNECTION_STRING)
# share_name, directory_name, file_name, local_file_path, content_settings=None,metadata=None, validate_content=False, progress_callback=None,max_connections=2, timeout=None
file_service.create_file_from_path(share_name=CONTAINER_NAME,
directory_name=DIRECTORY_NAME,
file_name=file_name,
local_file_path=full_path_to_file,
content_settings=ContentSettings(content_type='image/png'))
except Exception as e:
# logging inserted here
print(e)
if __name__ == '__main__':
upload_webcam_data(file_name, full_path_to_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.