drivendataorg / cloudpathlib

Python pathlib-style classes for cloud storage services such as Amazon S3, Azure Blob Storage, and Google Cloud Storage.
https://cloudpathlib.drivendata.org
MIT License
478 stars 62 forks source link

Azure: `_check_hns` throws an `HttpResponseError` #486

Open M0dEx opened 4 days ago

M0dEx commented 4 days ago

It seems that the self.service_client.get_account_information() can throw an HttpResponseError when the client is supplied with a DefaultAzureCredential:

azure.core.exceptions.HttpResponseError: This request is not authorized to perform this operation using this permission.
RequestId:XXXXXXXXXXXXXXXXXX
Time:2024-11-21T13:35:08.6097052Z
ErrorCode:AuthorizationPermissionMismatch
Content: <?xml version="1.0" encoding="utf-8"?><Error><Code>AuthorizationPermissionMismatch</Code><Message>This request is not authorized to perform this operation using this permission.
RequestId:8XXXXXXXXXXXXXXXXXX
Time:2024-11-21T13:35:08.6097052Z</Message></Error>

Maybe the except ResourceNotFoundError should be extended to catch the HttpResponseError as well?