Skip to content

Commit 4e29698

Browse files
Support account_host and check blob size attribute exists (#341)
1 parent 591485b commit 4e29698

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

adlfs/spec.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -624,10 +624,16 @@ def do_connect(self):
624624
self.service_client = AIOBlobServiceClient.from_connection_string(
625625
conn_str=self.connection_string
626626
)
627-
elif self.account_name:
628-
self.account_url: str = (
629-
f"https://{self.account_name}.blob.core.windows.net"
630-
)
627+
elif self.account_name is not None:
628+
if hasattr(self, 'account_host'):
629+
self.account_url: str = (
630+
f"https://{self.account_host}"
631+
)
632+
else:
633+
self.account_url: str = (
634+
f"https://{self.account_name}.blob.core.windows.net"
635+
)
636+
631637
creds = [self.credential, self.account_key]
632638
if any(creds):
633639
self.service_client = [
@@ -981,7 +987,7 @@ async def _ls(
981987
outblobs.append(blob_)
982988
elif (
983989
blob_["name"].count("/") == depth
984-
and blob_["size"] == 0
990+
and (hasattr(blob_, "size") and blob_["size"] == 0)
985991
):
986992
outblobs.append(blob_)
987993
else:
@@ -2068,10 +2074,15 @@ def connect_client(self):
20682074
ValueError if none of the connection details are available
20692075
"""
20702076
try:
2077+
if hasattr(self.fs, 'account_host'):
2078+
self.fs.account_url: str = (
2079+
f"https://{self.fs.account_host}"
2080+
)
2081+
else:
2082+
self.fs.account_url: str = (
2083+
f"https://{self.fs.account_name}.blob.core.windows.net"
2084+
)
20712085

2072-
self.fs.account_url: str = (
2073-
f"https://{self.fs.account_name}.blob.core.windows.net"
2074-
)
20752086
creds = [self.fs.sync_credential, self.fs.account_key, self.fs.credential]
20762087
if any(creds):
20772088
self.container_client = [

0 commit comments

Comments
 (0)