Package: azure-storage-file-share
Azure Storage File Share client library for PythonAzure File Share storage offers fully managed file shares in the cloud that are accessible via the industry standardServer Message Block (SMB) protocol. Azure file shares can be mounted concurrently by cloud or on-premises deployments of Windows, Linux, and macOS. Additionally, Azure file shares can be cached on Windows Servers with Azure File Sync for fast access near where the data is being used.Azure file shares can be used to:Replace or supplement on-premises file servers"Lift and shift" applicationsSimplify cloud development with shared application settings, diagnostic share, and Dev/Test/Debug toolsSource code|Package (PyPI)|Package (Conda)|API reference documentation|Product documentation|SamplesGetting startedPrerequisitesPython 3.7 or later is required to use this package. For more details, please read our page onAzure SDK for Python version support policy.You must have anAzure subscriptionand anAzure storage accountto use this package.Install the packageInstall the Azure Storage File Share client library for Python withpip:pipinstallazure-storage-file-shareCreate a storage accountIf you wish to create a new storage account, you can use theAzure Portal,Azure PowerShell,
orAzure CLI:# Create a new resource group to hold the storage account -# if using an existing resource group, skip this stepazgroupcreate--namemy-resource-group--locationwestus2# Create the storage accountazstorageaccountcreate-nmy-storage-account-name-gmy-resource-groupCreate the clientThe Azure Storage File Share client library for Python allows you to interact with four types of resources: the storage
account itself, file shares, directories, and files. Interaction with these resources starts with an instance of aclient. To create a client object, you will need the storage account's file service URL and a
credential that allows you to access the storage account:fromazure.storage.fileshareimportShareServiceClientservice=ShareServiceClient(account_url="https://<my-storage-account-name>.file.core.windows.net/",credential=credential)Looking up the account URLYou can find the storage account's file service URL using theAzure Portal,Azure PowerShell,
orAzure CLI:# Get the file service URL for the storage accountazstorageaccountshow-nmy-storage-account-name-gmy-resource-group--query"primaryEndpoints.file"Types of credentialsThecredentialparameter may be provided in a number of different forms, depending on the type ofauthorizationyou wish to use:To use ashared access signature (SAS) token,
provide the token as a string. If your account URL includes the SAS token, omit the credential parameter.
You can generate a SAS token from the Azure Portal under "Shared access signature" or use one of thegenerate_sas()functions to create a sas token for the storage account, share, or file:fromdatetimeimportdatetime,timedeltafromazure.storage.fileshareimportShareServiceClient,generate_account_sas,ResourceTypes,AccountSasPermissionssas_token=generate_account_sas(account_name="<storage-account-name>",account_key="<account-access-key>",resource_types=ResourceTypes(service=True),permission=AccountSasPermissions(read=True),expiry=datetime.utcnow()+timedelta(hours=1))share_service_client=ShareServiceClient(account_url="https://<my_account_name>.file.core.windows.net",credential=sas_token)To use a storage accountshared key(aka account key or access key), provide the key as a string. This can be found in the Azure Portal under the "Access Keys"
section or by running the following Azure CLI command:az storage account keys list -g MyResourceGroup -n MyStorageAccountUse the key as the credential parameter to authenticate the client:fromazure.storage.fileshareimportShareServiceClientservice=ShareServiceClient(account_url="https://<my_account_name>.file.core.windows.net",credential="<account_access_key>")Creating the client from a connection stringDepending on your use case and authorization method, you may prefer to initialize a client instance with a storage
connection string instead of providing the account URL and credential separately. To do this, pass the storage
connection string to the client'sfrom_connection_stringclass method:fromazure.storage.fileshareimportShareServiceClientconnection_string="DefaultEndpointsProtocol=https;AccountName=xxxx;AccountKey=xxxx;EndpointSuffix=core.windows.net"service=ShareServiceClient.from_connection_string(conn_str=connection_string)The connection string to your storage account can be found in the Azure Portal under the "Access Keys" section or by running the following CLI command:azstorageaccountshow-connection-string-gMyResourceGroup-nMyStorageAccountKey conceptsThe following components make up the Azure File Share Service:The storage account itselfA file share within the storage accountAn optional hierarchy of directories within the file shareA file within the file share, which may be up to 1 TiB in sizeThe Azure Storage File Share client library for Python allows you to interact with each of these components through the
use of a dedicated client object.Async ClientsThis library includes a complete async API supported on Python 3.5+. To use it, you must
first install an async transport, such asaiohttp.
Seeazure-core documentationfor more information.Async clients and credentials should be closed when they're no longer needed. These
objects are async context managers and define asyncclosemethods.ClientsFour different clients are provided to interact with the various components of the File Share Service:ShareServiceClient-
this client represents interaction with the Azure storage account itself, and allows you to acquire preconfigured
client instances to access the file shares within. It provides operations to retrieve and configure the service
properties as well as list, create, and delete shares within the account. To perform operations on a specific share,
retrieve a client using theget_share_clientmethod.ShareClient-
this client represents interaction with a specific file share (which need not exist yet), and allows you to acquire
preconfigured client instances to access the directories and files within. It provides operations to create, delete,
configure, or create snapshots of a share and includes operations to create and enumerate the contents of
directories within it. To perform operations on a specific directory or file, retrieve a client using theget_directory_clientorget_file_clientmethods.ShareDirectoryClient-
this client represents interaction with a specific directory (which need not exist yet). It provides operations to
create, delete, or enumerate the contents of an immediate or nested subdirectory, and includes operations to create
and delete files within it. For operations relating to a specific subdirectory or file, a client for that entity can
also be retrieved using theget_subdirectory_clientandget_file_clientfunctions.ShareFileClient-
this client represents interaction with a specific file (which need not exist yet). It provides operations to
upload, download, create, delete, and copy a file.For details on path naming restrictions, seeNaming and Referencing Shares, Directories, Files, and Metadata.ExamplesThe following sections provide several code snippets covering some of the most common Storage File Share tasks, including:Creating a file shareUploading a fileDownloading a fileListing contents of a directoryCreating a file shareCreate a file share to store your filesfromazure.storage.fileshareimportShareClientshare=ShareClient.from_connection_string(conn_str="<connection_string>",share_name="myshare")share.create_share()Use the async client to create a file sharefromazure.storage.fileshare.aioimportShareClientshare=ShareClient.from_connection_string(conn_str="<connection_string>",share_name="myshare")awaitshare.create_share()Uploading a fileUpload a file to the sharefromazure.storage.fileshareimportShareFileClientfile_client=ShareFileClient.from_connection_string(conn_str="<connection_string>",share_name="myshare",file_path="my_file")withopen("./SampleSource.txt","rb")assource_file:file_client.upload_file(source_file)Upload a file asynchronouslyfromazure.storage.fileshare.aioimportShareFileClientfile_client=ShareFileClient.from_connection_string(conn_str="<connection_string>",share_name="myshare",file_path="my_file")withopen("./SampleSource.txt","rb")assource_file:awaitfile_client.upload_file(source_file)Downloading a fileDownload a file from the sharefromazure.storage.fileshareimportShareFileClientfile_client=ShareFileClient.from_connection_string(conn_str="<connection_string>",share_name="myshare",file_path="my_file")withopen("DEST_FILE","wb")asfile_handle:data=file_client.download_file()data.readinto(file_handle)Download a file asynchronouslyfromazure.storage.fileshare.aioimportShareFileClientfile_client=ShareFileClient.from_connection_string(conn_str="<connection_string>",share_name="myshare",file_path="my_file")withopen("DEST_FILE","wb")asfile_handle:data=awaitfile_client.download_file()awaitdata.readinto(file_handle)Listing contents of a directoryList all directories and files under a parent directoryfromazure.storage.fileshareimportShareDirectoryClientparent_dir=ShareDirectoryClient.from_connection_string(conn_str="<connection_string>",share_name="myshare",directory_path="parent_dir")my_list=list(parent_dir.list_directories_and_files())print(my_list)List contents of a directory asynchronouslyfromazure.storage.fileshare.aioimportShareDirectoryClientparent_dir=ShareDirectoryClient.from_connection_string(conn_str="<connection_string>",share_name="myshare",directory_path="parent_dir")my_files=[]asyncforiteminparent_dir.list_directories_and_files():my_files.append(item)print(my_files)Optional ConfigurationOptional keyword arguments that can be passed in at the client and per-operation level.Retry Policy configurationUse the following keyword arguments when instantiating a client to configure the retry policy:retry_total(int): Total number of retries to allow. Takes precedence over other counts.
Pass inretry_total=0if you do not want to retry on requests. Defaults to 10.retry_connect(int): How many connection-related errors to retry on. Defaults to 3.retry_read(int): How many times to retry on read errors. Defaults to 3.retry_status(int): How many times to retry on bad status codes. Defaults to 3.retry_to_secondary(bool): Whether the request should be retried to secondary, if able.
This should only be enabled of RA-GRS accounts are used and potentially stale data can be handled.
Defaults toFalse.Other client / per-operation configurationOther optional configuration keyword arguments that can be specified on the client or per-operation.Client keyword arguments:connection_timeout(int): The number of seconds the client will wait to establish a connection to the server.
Defaults to 20 seconds.read_timeout(int): The number of seconds the client will wait, between consecutive read operations, for a
response from the server. This is a socket level timeout and is not affected by overall data size. Client-side read
timeouts will be automatically retried. Defaults to 60 seconds.transport(Any): User-provided transport to send the HTTP request.Per-operation keyword arguments:raw_response_hook(callable): The given callback uses the response returned from the service.raw_request_hook(callable): The given callback uses the request before being sent to service.client_request_id(str): Optional user specified identification of the request.user_agent(str): Appends the custom value to the user-agent header to be sent with the request.logging_enable(bool): Enables logging at the DEBUG level. Defaults to False. Can also be passed in at
the client level to enable it for all requests.logging_body(bool): Enables logging the request and response body. Defaults to False. Can also be passed in at
the client level to enable it for all requests.headers(dict): Pass in custom headers as key, value pairs. E.g.headers={'CustomValue': value}TroubleshootingGeneralStorage File clients raise exceptions defined inAzure Core.This list can be used for reference to catch thrown exceptions. To get the specific error code of the exception, use theerror_codeattribute, i.e,exception.error_code.LoggingThis library uses the standardlogginglibrary for logging.
Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
level.Detailed DEBUG level logging, including request/response bodies and unredacted
headers, can be enabled on a client with thelogging_enableargument:importsysimportloggingfromazure.storage.fileshareimportShareServiceClient# Create a logger for the 'azure.storage.fileshare' SDKlogger=logging.getLogger('azure.storage.fileshare')logger.setLevel(logging.DEBUG)# Configure a console outputhandler=logging.StreamHandler(stream=sys.stdout)logger.addHandler(handler)# This client will log detailed information about its HTTP sessions, at DEBUG levelservice_client=ShareServiceClient.from_connection_string("your_connection_string",logging_enable=True)Similarly,logging_enablecan enable detailed logging for a single operation,
even when it isn't enabled for the client:service_client.get_service_properties(logging_enable=True)Next stepsMore sample codeGet started with ourFile Share samples.Several Storage File Share Python SDK samples are available to you in the SDK's GitHub repository. These samples provide example code for additional scenarios commonly encountered while working with Storage File Share:file_samples_hello_world.py(async version) - Examples found in this article:Client creationCreate a file shareUpload a filefile_samples_authentication.py(async version) - Examples for authenticating and creating the client:From a connection stringFrom a shared access keyFrom a shared access signature tokenfile_samples_service.py(async version) - Examples for interacting with the file service:Get and set service propertiesCreate, list, and delete sharesGet a share clientfile_samples_share.py(async version) - Examples for interacting with file shares:Create a share snapshotSet share quota and metadataList directories and filesGet the directory or file client to interact with a specific entityfile_samples_directory.py(async version) - Examples for interacting with directories:Create a directory and add filesCreate and delete subdirectoriesGet the subdirectory clientfile_samples_client.py(async version) - Examples for interacting with files:Create, upload, download, and delete filesCopy a file from a URLAdditional documentationFor more extensive documentation on Azure File Share storage, see theAzure File Share storage documentationon docs.microsoft.com.ContributingThis project welcomes contributions and suggestions.  Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visithttps://cla.microsoft.com.When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.This project has adopted theMicrosoft Open Source Code of Conduct. For more information see theCode of Conduct FAQor contactopencode@microsoft.comwith any additional questions or comments.Release History12.15.0 (2023-11-07)Features AddedStable release of features from 12.15.0b112.15.0b1 (2023-10-17)Features AddedAdded support for service version 2023-11-03.Addedaudienceas an optional keyword that can be specified on APIs that have acredentialparameter. This
keyword only has an effect when the credential provided is of typeTokenCredential.12.14.2 (2023-10-10)Bugs FixedFixed an issue when an invalid type was provided forcredentialduring client construction, the__str__of the object would be present in the exception message and therefore potentially logged.12.14.1 (2023-09-13)Bugs FixedFixed breakingKeyError: 'sdk_moniker'increate_configuration.
NOTE: This is not an exported method and therefore should not be imported/called directly.12.14.0 (2023-09-12)Features AddedStable release of features from 12.14.0b112.14.0b1 (2023-08-08)Features AddedAdded support for service versions 2023-05-03 and 2023-08-03.12.13.0 (2023-07-11)Features AddedStable release of features from 12.13.0b112.13.0b1 (2023-05-30)Features AddedAdded support for service version 2023-01-03.Addedaccess_rightsproperty toHandle.12.12.0 (2023-04-12)Features AddedStable release of features from 12.12.0b112.12.0b1 (2023-03-28)Features AddedAdded support for service version 2022-11-02.Added support forTokenCredentialto be used for authentication. ATokenCredentialcan be provided for thecredentialparameter to any client constructor.Note:When using aTokenCredential, the new keyword parametertoken_intentisrequiredand must be provided. Additionally, this form of authentication is only supported for
certain operations in the Data Plane SDK.Added support forallow_trailing_dotandallow_source_trailing_doton client construction. Whenallow_trailing_dotis provided, the service will not silently remove any trailing.character from directory/file
names for all operations made from that client.allow_source_trailing_dotwill apply this same rule to source files
when performing a rename or copy operation.12.11.1 (2023-03-08)Bugs FixedFixed "duplicate type signatures" MyPy error.12.11.0 (2023-02-22)Features AddedStable release of features from 12.11.0b112.11.0b1 (2023-02-02)Features AddedAdded support for service version 2021-12-02.Added support for file and directory paths that contain invalid XML characters. When listing or fetching properties,
the service will encode illegal characters and the SDK will now automatically decode them.Added support forAsyncIterableas data type for async file upload.Bugs FixedFixed an issue where keywordname_starts_withwas not being passed to the service properly for thelist_sharesasync APIOther ChangesRemovedmsrestdependency.Addedtyping-extensions>=4.0.1as a dependency.Addedisodate>=0.6.1as a dependency.Added extra dependencyaiofor installing optional async dependencies. Usepip install azure-storage-file-share[aio]to install.12.10.1 (2022-10-18)Bugs FixedFixed possibleValueErrorfor invalid content range that gets raised when downloading empty files through Azurite.12.10.0 (2022-10-11)Features AddedStable release of features from 12.10.0b1.Bugs FixedFixed an issue where callingdownload_filewith an invalid base64-encoded account key would raise anAttributeErrorrather than the properAzureSigningError.Other ChangesChanged the default value forread_timeoutto 60 seconds for all clients.12.10.0b1 (2022-08-23)This version and all future versions will require Python 3.7+. Python 3.6 is no longer supported.Features AddedAdded support forAzureNamedKeyCredentialas a validcredentialtype.12.9.0 (2022-07-07)Features AddedStable release of features from 12.9.0b1.Added support for progress tracking toupload_file()anddownload_file()via a new optional callback,progress_hook.12.9.0b1 (2022-06-15)Features AddedAdded support forfile_change_timetostart_copy_from_urlAPI12.8.0 (2022-05-09)Features AddedStable release of features from 12.8.0b1.Bugs FixedFixed a bug, introduced in the previous beta release, that caused Authentication errors when attempting to use
an Account SAS with certain service level operations.12.8.0b1 (2022-04-14)Features AddedAdded support for service version 2021-06-08.Added support for missing parameters oncreate_directory()includingfile_attributes,file_creation_time,file_last_write_time,file_permissionandfile_permission_key.Added support for settingcontent_typeonrename_file().Added support for settingfile_change_timeoncreate_directory(),set_http_headers()(directory)rename_directory(),create_file(),set_http_headers()(file) andrename_file().Added support for settingfile_last_write_modeonupload_range()andupload_range_from_url()with possible values ofNoworPreserve.Bugs FixedUpdatedcreate_share()docstring to have the correct return-type ofNone12.7.0 (2022-03-08)This version and all future versions will require Python 3.6+. Python 2.7 is no longer supported.Stable release of preview featuresAdded support for service version 2021-02-12, 2021-04-10.Added support for premium file share provisioned_bandwidth property.Added support for checking if a directory exists usingexists().Added support forrename_directory()andrename_file().Added support forCreate (c)SAS permission for Share SAS.Bugs FixedFixed a bug wherestart_copy_from_url()was not sending theignore_read_onlyparameter correctly.12.7.0b2 (2022-02-08)This version and all future versions will require Python 3.6+. Python 2.7 is no longer supported.Features AddedAdded support for service version 2021-04-10.Added support forrename_directory()andrename_file().Added support forCreate (c)SAS permission for Share SAS.Bugs FixedUpdateazure-coredependency to avoid inconsistent dependencies from being installed.Fixed a bug, that was introduced in the previous beta release, wheregenerate_account_sas()was not generating the proper SAS signature.12.7.0b1 (2021-12-13)Features AddedAdded support for service version 2021-02-12.Added support for premium file share provisioned_bandwidth property.Added support for checking if a directory exists usingexists().12.6.0 (2021-09-15)Stable release of preview featuresAdded support for service version 2020-10-02 (STG78)Added OAuth support for file copy source.12.6.0b1 (2021-07-27)New featuresAdded OAuth support for file copy source.FixesEnsured that download fails if file modified mid download12.5.0 (2021-06-09)New featuresAdded support for lease operation on a share, eg. acquire_lease12.5.0b1 (2021-05-12)New featuresAdded support for lease operation on a share, eg. acquire_lease12.4.2 (2021-04-20)FixesMakeAccountName,AccountKeyetc. in conn_str case insensitiveFixeddownloader.chunks()return chunks in different size (#9419, #15648)Fixed unclosedThreadPoolExecutor(#8955)12.4.1 (2021-01-20)FixesFixed msrest dependency issue (#16250)12.4.0 (2021-01-13)Stable release of preview featuresAdded support for enabling root squash and share protocols for file share.Added support forAzureSasCredentialto allow SAS rotation in long living clients.12.4.0b1 (2020-12-07)New featuresAdded support for enabling root squash and share protocols for file share.12.3.0 (2020-11-10)Stable release of preview featuresPreview feature enabling SMB Multichannel for the share service.Preview featureget_rangeson ShareFileClientNew featuresAddedset_share_propertieswhich allows setting share tier.NotesUpdated dependencyazure-corefrom  azure-core<2.0.0,>=1.2.2 to azure-core<2.0.0,>=1.9.0 to get continuation_token attr on AzureError.12.3.0b1 (2020-10-02)New featuresAdded support for enabling SMB Multichannel for the share service.Added support for leasing a share.Added support for getting the range diff between current file and a snapshot as well as getting the diff between two file snapshots.12.2.0 (2020-08-13)Stable release of preview featuresPreview featureundelete_shareon FileShareServiceClient.12.2.0b1 (2020-07-07)New featuresAddedundelete_shareon FileShareServiceClient so that users can restore deleted share on share soft delete enabled account. Users can also list deleted shares whenlist_sharesby specifyinginclude_deleted=True.12.1.2FixesImprove the performance of upload when using max_concurrency12.1.1 (2020-03-10)NotesTheStorageUserAgentPolicyis now replaced with theUserAgentPolicyfrom azure-core. With this, the custom user agents are now added as a prefix instead of being appended.12.1.0New featuresAdded support for the 2019-07-07 service version, and addedapi_versionparameter to clients.ShareLeaseClientwas introduced to both sync and async versions of the SDK, which allows users to perform operations on file leases.failed_handles_countinfo was included inclose_handleandclose_all_handlesresult.Added support for obtaining premium file properties inlist_sharesandget_share_properties.Added support for additionalstart_copy_from_urlparameters -file_permission,permission_key,file_attributes,file_creation_time,file_last_write_time,ignore_read_only, andset_archive_attribute.Fixes and improvementsFixed a bug:clear_rangeAPI was not working.FixesResponses are always decoded as UTF812.0.0New featuresAddeddelete_directorymethod to theshare_client.All the clients now have aclose()method to close the sockets opened by the client when using without a context manager.Fixes and improvementsFixes a bug where determining length breaks while uploading a file when provided with an invalid fileno.Breaking changesclose_handle(handle)andclose_all_handles()no longer return int. These functions return a dictionary which has the number of handles closed and number of handles failed to be closed.12.0.0b5Important: This package was previously named azure-storage-fileGoing forward, to use this SDK, please installazure-storage-file-share.
Additionally:The namespace within the package has also been renamed toazure.storage.fileshare.FileServiceClienthas been renamed toShareServiceClient.DirectoryClienthas been renamed toShareDirectoryClient.FileClienthas been renamed toShareFileClient.Additional Breaking changesShareClientnow accepts onlyaccount_urlwith mandatory a string paramshare_name.
To use a share_url, the methodfrom_share_urlmust be used.ShareDirectoryClientnow accepts onlyaccount_urlwith mandatory string paramsshare_nameanddirectory_path.
To use a directory_url, the methodfrom_directory_urlmust be used.ShareFileClientnow accepts onlyaccount_urlwith mandatory string paramsshare_nameandfile_path. To use a file_url, the methodfrom_file_urlmust be used.file_permission_keyparameter has been renamed topermission_keyset_share_access_policyhas required parametersigned_identifiers.NoRetrypolicy has been removed. Use keyword argumentretry_total=0for no retries.Removed types that were accidentally exposed from two modules. OnlyShareServiceClient,ShareClient,ShareDirectoryClientandShareFileClientshould be imported from azure.storage.fileshare.aioSome parameters have become keyword only, rather than positional. Some examples include:loopmax_concurrencyvalidate_contenttimeoutetc.Client and model files have been made internal. Users should import from the top level modulesazure.storage.fileshareandazure.storage.fileshare.aioonly.Thegenerate_shared_access_signaturemethods on each ofShareServiceClient,ShareClientandShareFileClienthave been replaced by module level functionsgenerate_account_sas,generate_share_sasandgenerate_file_sas.start_rangeandend_rangeparams are now renamed to and behave likeoffsetandlengthin
the following APIs:download_fileupload_rangeupload_range_from_urlclear_rangeget_rangesStorageStreamDownloaderis no longer iterable. To iterate over the file data stream, useStorageStreamDownloader.chunks.The public attributes ofStorageStreamDownloaderhave been limited to:name(str): The name of the file.path(str): The full path of the file.share(str): The share the file will be downloaded from.properties(FileProperties): The properties of the file.size(int): The size of the download. Either the total file size, or the length of a subsection if specified. Previously calleddownload_size.StorageStreamDownloadernow has new functions:readall(): Reads the complete download stream, returning bytes. This replaces the functionscontent_as_bytesandcontent_as_textwhich have been deprecated.readinto(stream): Download the complete stream into the supplied writable stream, returning the number of bytes written. This replaces the functiondownload_to_streamwhich has been deprecated.ShareFileClient.close_handlesandShareDirectoryClient.close_handleshave both been replaced by two functions each;close_handle(handle)andclose_all_handles(). These functions are blocking and return integers (the number of closed handles) rather than polling objects.get_service_propertiesnow returns a dict with keys consistent toset_service_propertiesNew featuresResourceTypes,NTFSAttributes, andServicesnow have methodfrom_stringwhich takes parameters as a string.12.0.0b4Breaking changesPermission models.AccountPermissions,SharePermissionsandFilePermissionshave been renamed toAccountSasPermissions,ShareSasPermissionsandFileSasPermissionsrespectively.enum-like list parameters have been removed from all three of them.__add__and__or__methods are removed.max_connectionsis now renamed tomax_concurrency.New featuresAccountSasPermissions,FileSasPermissions,ShareSasPermissionsnow have methodfrom_stringwhich
takes parameters as a string.12.0.0b3New featuresAdded upload_range_from_url API to write the bytes from one Azure File endpoint into the specified range of another Azure File endpoint.Added set_http_headers for directory_client, create_permission_for_share and get_permission_for_share APIs.Added optional parameters for smb properties related parameters for create_file*, create_directory* related APIs and set_http_headers API.Updated get_properties for directory and file so that the response has SMB properties.Dependency updatesAdoptedazure-core1.0.0b3If you later want to revert to previous versions of azure-storage-file, or another Azure SDK
library requiring azure-core 1.0.0b1 or azure-core 1.0.0b2, you must explicitly install
the specific version of azure-core as well. For example:pip install azure-core==1.0.0b2 azure-storage-file==12.0.0b2Fixes and improvementsFix where content-type was being added in the request when not mentioned explicitly.12.0.0b2Breaking changesRenamedcopy_file_from_urltostart_copy_from_urland changed behaviour to return a dictionary of copy properties rather than a polling object. Status of the copy operation can be retrieved with theget_file_propertiesoperation.Addedabort_copyoperation to theFileClientclass. This replaces the previous abort operation on the copy status polling operation.The behavior of listing operations has been modified:The previousmarkerparameter has been removed.The iterable response object now supports aby_pagefunction that will return a secondary iterator of batches of results. This function supports acontinuation_tokenparameter to replace the previousmarkerparameter.The new listing behaviour is also adopted by thereceive_messagesoperation:The receive operation returns a message iterator as before.The returned iterator supports aby_pageoperation to receive messages in batches.New featuresAdded async APIs to subnamespaceazure.storage.file.aio.Distributed tracing framework OpenCensus is now supported.Dependency updatesAdoptedazure-core1.0.0b2If you later want to revert to azure-storage-file 12.0.0b1, or another Azure SDK
library requiring azure-core 1.0.0b1, you must explicitly install azure-core
1.0.0b1 as well. For example:pip install azure-core==1.0.0b1 azure-storage-file==12.0.0b1Fixes and improvementsFix for closing file handles - continuation token was not being passed to subsequent calls.General refactor of duplicate and shared code.12.0.0b1Version 12.0.0b1 is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Storage Files. For more information about this, and preview releases of other Azure SDK libraries, please visithttps://aka.ms/azure-sdk-preview1-python.Breaking changes: New API designOperations are now scoped to a particular client:FileServiceClient: This client handles account-level operations. This includes managing service properties and listing the shares within an account.ShareClient: The client handles operations for a particular share. This includes creating or deleting that share, as well as listing the directories within that share, and managing properties and metadata.DirectoryClient: The client handles operations for a particular directory. This includes creating or deleting that directory, as well as listing the files and subdirectories, and managing properties and metadata.FileClient: The client handles operations for a particular file. This includes creating or deleting that file, as well as upload and download data and managing properties.These clients can be accessed by navigating down the client hierarchy, or instantiated directly using URLs to the resource (account, share, directory or file).
For full details on the new API, please see thereference documentation.The copy file operation now returns a polling object that can be used to check the status of the operation, as well as abort the operation.Theclose_handlesoperation now return a polling object that can be used to check the status of the operation.Download operations now return a streaming object that can download data in multiple ways:Iteration: The streamer is an iterable object that will download and yield the content in chunks. Only supports single threaded download.content_as_bytes: Return the entire file content as bytes. Blocking operation that supports multi-threaded download.content_as_text: Return the entire file content as decoded text. Blocking operation that supports multi-threaded download.download_to_stream: Download the entire content to an open stream handle (e.g. an open file). Supports multi-threaded download.New underlying REST pipeline implementation, based on the newazure.corelibrary.Client and pipeline configuration is now available via keyword arguments at both the client level, and per-operation. See reference documentation for a full list of optional configuration arguments.New error hierarchy:All service errors will now use the base type:azure.core.exceptions.HttpResponseErrorThe are a couple of specific exception types derived from this base type for common error scenarios:ResourceNotFoundError: The resource (e.g. queue, message) could not be found. Commonly a 404 status code.ResourceExistsError: A resource conflict - commonly caused when attempting to create a resource that already exists.ResourceModifiedError: The resource has been modified (e.g. overwritten) and therefore the current operation is in conflict. Alternatively this may be raised if a condition on the operation is not met.ClientAuthenticationError: Authentication failed.Operationset_file_propertieshas been renamed toset_http_headers.Operationsget_file_to_<output>have been replaced withdownload_file. See above for download output options.Operationscreate_file_from_<input>have been replace withupload_file.Operationsget_share_aclandset_share_aclhave been renamed toget_share_access_policyandset_share_access_policy.Operationset_share_propertieshas been renamed toset_share_quota.Operationsnapshot_sharehas been renamed tocreate_snapshot.Operationcopy_filehas been renamed tocopy_file_from_url.No longer have specific operations forget_metadata- useget_propertiesinstead.No longer have specific operations forexists- useget_propertiesinstead.Operationupdate_rangehas been renamed toupload_range.2.0.1Updated dependency on azure-storage-common.2.0.0Support for 2018-11-09 REST version. Please see our REST API documentation and blogs for information about the related added features.Added an option to get share stats in bytes.Added support for listing and closing file handles.1.4.0azure-storage-nspkg is not installed anymore on Python 3 (PEP420-based namespace package)1.3.1Fixed design flaw where get_file_to_* methods buffer entire file when max_connections is set to 1.1.3.0Support for 2018-03-28 REST version. Please see our REST API documentation and blog for information about the related added features.1.2.0rc1Support for 2017-11-09 REST version. Please see our REST API documentation and blog for information about the related added features.1.1.0Support for 2017-07-29 REST version. Please see our REST API documentation and blogs for information about the related added features.Error message now contains the ErrorCode from the x-ms-error-code header value.1.0.0The package has switched from Apache 2.0 to the MIT license.Fixed bug where get_file_to_* cannot get a single byte when start_range and end_range are both equal to 0.Metadata keys are now case-preserving when fetched from the service. Previously they were made lower-case by the library.