あなたの提案、Perter Panありがとうございます。私はしかしAzure PUT Blob authentication fails in R
を追っ
、スクリプトが失敗する実行されます。 エラーメッセージは、私は問題がhttpsのアクセスに関連して考え
error:1411809D:SSL routines:SSL_CHECK_SERVERHELLO_TLSEXT:tls invalid
ecpointformat list
ました。 (AzureのMLでBLOBストレージにアクセスするためのPythonスクリプトを使用しているとき、私はまたAccess Azure blog storage from within an Azure ML experimentが続いていたので、私はこれを書く)
私はR見つかり同じ問題がそれでは Error:1411809D:SSL routines - When trying to make https call from inside R module in AzureML
で、私は、HTTPSを変更http。 しかし、スクリプトはBLOBストレージに何度もアクセスしようとし、決して実行を終了しません。 Azureポータルのストレージで要求数が非常に増えていることがわかります。
私のコードは、実際に要求URLがスクリプトは打撃であるHTTP
に変更することを除いてAzure PUT Blob authentication fails in R に似ています。
library(httr)
account <- "accountname"
container <- "containrname"
filename <- "test.txt"
key <- "8FS+3i9eXx....r54Gl97F0nVwyDcV7lXbcWhmQ=="
object <- "Hello World"
url <- paste0("http://", account, ".blob.core.windows.net/", container,
"/", filename)
requestdate <- format(Sys.time(),"%a, %d %b %Y %H:%M:%S %Z", tz="GMT")
content_length <- nchar(object, type = "bytes")
signature_string <- paste0("PUT", "\n", # HTTP Verb
"\n", # Content-Encoding
"\n", # Content-Language
content_length, "\n", # Content-Length
"\n", # Content-MD5
"text/plain", "\n", # Content-Type
"\n", # Date
"\n", # If-Modified-Since
"\n", # If-Match
"\n", # If-None-Match
"\n", # If-Unmodified-Since
"\n", # Range
# Here comes the Canonicalized Headers
"x-ms-blob-type:BlockBlob","\n",
"x-ms-date:",requestdate,"\n",
"x-ms-version:2015-02-21","\n",
# Here comes the Canonicalized Resource
"/",account, "/",container,"/", filename)
headerstuff <- add_headers(Authorization=paste0("SharedKey
",account,":",
RCurl::base64(digest::hmac(key =
RCurl::base64Decode(key, mode = "raw"),
object = enc2utf8(signature_string),
algo = "sha256", raw = TRUE))),
`Content-Length` = content_length,
`x-ms-date`= requestdate,
`x-ms-version`= "2015-02-21",
`x-ms-blob-type`="BlockBlob",
`Content-Type`="text/plain")
content(PUT(url, config = headerstuff, body = object, verbose()), as =
"text")