File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 2222    ResourceExistsError ,
2323    ResourceNotFoundError ,
2424)
25+ from  azure .core .utils  import  parse_connection_string 
2526from  azure .storage .blob  import  (
2627    BlobBlock ,
2728    BlobProperties ,
@@ -1550,11 +1551,19 @@ async def _url(
15501551        """ 
15511552        container_name , blob , version_id  =  self .split_path (path )
15521553
1554+         if  self .connection_string :
1555+             args_dict  =  parse_connection_string (self .connection_string )
1556+             account_name  =  args_dict .get ("accountname" )
1557+             account_key  =  args_dict .get ("accountkey" )
1558+         else :
1559+             account_name  =  self .account_name 
1560+             account_key  =  self .account_key 
1561+ 
15531562        sas_token  =  generate_blob_sas (
1554-             account_name = self . account_name ,
1563+             account_name = account_name ,
15551564            container_name = container_name ,
15561565            blob_name = blob ,
1557-             account_key = self . account_key ,
1566+             account_key = account_key ,
15581567            permission = BlobSasPermissions (read = True ),
15591568            expiry = datetime .utcnow () +  timedelta (seconds = expires ),
15601569            version_id = version_id ,
Original file line number Diff line number Diff line change @@ -1629,6 +1629,26 @@ async def test_url_versioned(storage, mocker):
16291629    )
16301630
16311631
1632+ async  def  test_url_with_conn_str (mocker ):
1633+     fs  =  AzureBlobFileSystem (connection_string = CONN_STR )
1634+     generate_blob_sas  =  mocker .patch ("adlfs.spec.generate_blob_sas" )
1635+ 
1636+     await  fs ._url ("data/root/a/file.txt" )
1637+     generate_blob_sas .assert_called_once_with (
1638+         account_name = ACCOUNT_NAME ,
1639+         container_name = "data" ,
1640+         blob_name = "root/a/file.txt" ,
1641+         account_key = KEY ,
1642+         permission = mocker .ANY ,
1643+         expiry = mocker .ANY ,
1644+         version_id = None ,
1645+         content_disposition = None ,
1646+         content_encoding = None ,
1647+         content_language = None ,
1648+         content_type = None ,
1649+     )
1650+ 
1651+ 
16321652def  test_cp_file (storage ):
16331653    fs  =  AzureBlobFileSystem (
16341654        account_name = storage .account_name , connection_string = CONN_STR 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments