Microsoft Azure File DataLake Storage Client Library for Python
Overall
score
92%
Build a utility that manages HTTP headers and content settings for files stored in Azure Data Lake Storage Gen2.
Create a Python module that provides functionality to configure and retrieve HTTP headers for files in Azure Data Lake Storage. The module should handle:
Your implementation should include:
set_file_content_settings(file_client, content_type, content_encoding, content_language, content_disposition, cache_control) that configures all HTTP headers for a fileget_file_content_settings(file_client) that retrieves and returns the current content settingsupdate_files_by_extension(file_system_client, extension, content_type, cache_control) that updates content type and cache control for all files with a given extension@generates
def set_file_content_settings(file_client, content_type, content_encoding,
content_language, content_disposition, cache_control):
"""
Configure HTTP headers for a file in Azure Data Lake Storage.
Args:
file_client: DataLakeFileClient instance for the target file
content_type: MIME type of the content
content_encoding: Content encoding (e.g., 'gzip')
content_language: Content language (e.g., 'en-US')
content_disposition: Content disposition header
cache_control: Cache control directive
"""
pass
def get_file_content_settings(file_client):
"""
Retrieve current content settings for a file.
Args:
file_client: DataLakeFileClient instance for the target file
Returns:
dict: Dictionary containing content_type, content_encoding,
content_language, content_disposition, and cache_control
"""
pass
def update_files_by_extension(file_system_client, extension, content_type, cache_control):
"""
Update content settings for all files with a specific extension.
Args:
file_system_client: FileSystemClient instance
extension: File extension to filter (e.g., '.csv')
content_type: New content type to set
cache_control: New cache control directive to set
"""
passProvides Azure Data Lake Storage Gen2 client library for managing files and content settings.
Install with Tessl CLI
npx tessl i tessl/pypi-azure-storage-file-datalakedocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10