AzureSMR
AzureSMR copied to clipboard
Can't read/write to blob storage
Hi,
I've been able to interact with blob storage in the following ways: list all storage containers, list all storage blobs.
When I try writing a new blob using the following command: azurePutBlob(sc, storageAccount = "csb1898e872be2fx4a7bxac8", container = "reports", contents = "HELLO", blob = "Ad Group Performance Report2.csv") I get the following error message: "Opening and ending tag mismatch: meta line 5 and head Opening and ending tag mismatch: hr line 9 and body Opening and ending tag mismatch: body line 7 and html Premature end of data in tag head line 3 Premature end of data in tag html line 2"
Same happens when I try reading one of the blobs using the following command: azureGetBlob(sc, storageAccount = "csb1898e872be2fx4a7bxac8", container = "reports", blob="Audience Performance Report", type="text") Many thanks
Iyar
Hi @IyarLin
You are getting errors on the parsing HTML because the storage response returned a bad 400 malformed request. The blob name 'Ad Group Performance Report' is not URL encoded. AzureSMR will need to URL encode the blob name so the user doesn't have to do it.
Response [https://storageaccount.blob.core.windows.net/containerName/Ad Group Performance Report] Date: 2018-02-27 22:50 Status: 400 Content-Type: text/html; charset=us-ascii Size: 311 B
HTTP Error 400. The request is badly formed.
Fix: ad_group = azureGetBlob(sc, storageAccount = "storageAccount", container = "container", blob=utils::URLencode(blobName), type="text")
Many thanks! It works