Comment detail

HTTPでGET その2 (Nested Flatten)

タイムアウトはtimeoutというオプション、プロキシサーバーはhttp_proxyという環境変数でそれぞれ指定します。

http_proxyは、起動後初回のダウンロード処理を実行する前に、一度だけ設定可能です。その後は設定可・不可の切り替えはできますが、プロキシサーバーのホストを変更することはできません(These environment variables must be set before the download code is first used: they cannot be altered later by calling Sys.setenv)。

タイムアウトを1秒にすると、大抵のGETは失敗してしまうみたいですね。

1
2
3
4
5
http.get <- function(url, proxy='', timeout.value=1){
  options(timeout=timeout.value)
  Sys.setenv(http_proxy=proxy)
  readLines(url)
}

Index

Feed

Other

Link

Pathtraq

loading...