Zeppelin 上的 HTTP 请求
HTTP request on Zeppelin
有什么方法可以在 Zeppelin 段落中发出 HTTP 请求吗?例如
function get_app_name(){
//var xmlHttp = new XMLHttpRequest();
//xmlHttp.open( "GET", "https://example.com/application/key", true, 'username', 'password');
//xmlHttp.send( null );
URL url = new URL("https://example.com/application/key");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
}
我无法导入任何资源(例如 URL),因为解释器不允许(mongodb 解释器)。有没有办法在 Zeppelin 中发出简单的 GET 请求?我正在尝试为我的表获取不在指定数据库中的数据作为其他元素。
%mongodb
function wget(url){
var tmp = "/tmp";
var id = new ObjectId();
var outFile= tmp+"/wget"+id;
var p = run("wget", "--user=user", "--password=password", "-o log", "--output-document="+outFile,url);
if (p==0){
var result = cat(outFile);
removeFile(outFile);
return result;
} else {
return "";
}
}
url = "https://exampleurl.com/resource"
result = wget(url)
print(result)
有什么方法可以在 Zeppelin 段落中发出 HTTP 请求吗?例如
function get_app_name(){
//var xmlHttp = new XMLHttpRequest();
//xmlHttp.open( "GET", "https://example.com/application/key", true, 'username', 'password');
//xmlHttp.send( null );
URL url = new URL("https://example.com/application/key");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
}
我无法导入任何资源(例如 URL),因为解释器不允许(mongodb 解释器)。有没有办法在 Zeppelin 中发出简单的 GET 请求?我正在尝试为我的表获取不在指定数据库中的数据作为其他元素。
%mongodb
function wget(url){
var tmp = "/tmp";
var id = new ObjectId();
var outFile= tmp+"/wget"+id;
var p = run("wget", "--user=user", "--password=password", "-o log", "--output-document="+outFile,url);
if (p==0){
var result = cat(outFile);
removeFile(outFile);
return result;
} else {
return "";
}
}
url = "https://exampleurl.com/resource"
result = wget(url)
print(result)