I have an app that connects to account storage files in azure. I am using Python to connect account storage resource. One of the functions I use is 'create_directory()' from class 'from azure.storage.fileshare import (ShareDirectoryClient)'. Occasionally, Appears log:
Azure.core.exceptions.ServiceRequestError: (<urllib3.connection.HTTPSConnection object at 'object_resurce', 'Connection to 'name_of_the_account_storage_resurce'.file.core.windows.net timed out. (connect timeout=20)')
the func:
def create_dir(self,dir_name:str):
"""
This function will create a new directory in the storage account
Args:
-----
share_name (str): The share client name of storage account.
dir_name (str): The name of the created directory .
"""
#check if the directory is exists in account storage
if(self.dir_exists(dir_name)==False):
# Create a DirectoryClient from a connection string
self.dir_client =
ShareDirectoryClient.from_connection_string(
conn_str=self.connection_string,
share_name=self.share,
directory_path=dir_name)
self.dir_client.create_directory(timeout=60)
How can I fix it?
Tried to add timeout between connection tries, but didn't fix it