@@ -8,7 +8,7 @@ export PlutoNotebook, @resolve
8
8
9
9
10
10
"""
11
- evaluate(output::Symbol, filename::AbstractString, host::AbstractString="localhost:1234"; kwargs...)
11
+ evaluate(output::Symbol, filename::AbstractString, host::AbstractString="http:// localhost:1234"; kwargs...)
12
12
13
13
Function equivalent of syntax described in documentation for `PlutoNotebook`.
14
14
@@ -21,8 +21,8 @@ julia> PlutoRESTClient.evaluate(:c, "EuclideanDistance.jl"; a=5., b=12.)
21
21
13.0
22
22
```
23
23
"""
24
- function evaluate (output:: Symbol , filename:: AbstractString , host:: AbstractString = " localhost:1234" ; kwargs... )
25
- request_uri = HTTP. URI (" http:// $(host) /v1/notebook/$(HTTP. escapeuri (filename)) /eval" )
24
+ function evaluate (output:: Symbol , filename:: AbstractString , host:: AbstractString = " http:// localhost:1234" ; kwargs... )
25
+ request_uri = HTTP. URI (" $(host) /v1/notebook/$(HTTP. escapeuri (filename)) /eval" )
26
26
27
27
body = IOBuffer ()
28
28
Serialization. serialize (body, Dict {String, Any} (
@@ -44,12 +44,12 @@ function evaluate(output::Symbol, filename::AbstractString, host::AbstractString
44
44
end
45
45
46
46
"""
47
- call(fn_name::Symbol, args::Tuple, kwargs::Iterators.Pairs, filename::AbstractString, host::AbstractString="localhost:1234")
47
+ call(fn_name::Symbol, args::Tuple, kwargs::Iterators.Pairs, filename::AbstractString, host::AbstractString="http:// localhost:1234")
48
48
49
49
Function equivalent of syntax described in documentation for `PlutoCallable`.
50
50
"""
51
- function call (fn_name:: Symbol , args:: Tuple , kwargs:: Iterators.Pairs , filename:: AbstractString , host:: AbstractString = " localhost:1234" )
52
- request_uri = HTTP. URI (" http:// $(host) /v1/notebook/$(HTTP. escapeuri (filename)) /call" )
51
+ function call (fn_name:: Symbol , args:: Tuple , kwargs:: Iterators.Pairs , filename:: AbstractString , host:: AbstractString = " http:// localhost:1234" )
52
+ request_uri = HTTP. URI (" $(host) /v1/notebook/$(HTTP. escapeuri (filename)) /call" )
53
53
54
54
body = IOBuffer ()
55
55
Serialization. serialize (body, Dict {String, Any} (
@@ -72,23 +72,23 @@ function call(fn_name::Symbol, args::Tuple, kwargs::Iterators.Pairs, filename::A
72
72
end
73
73
74
74
"""
75
- static_function(output::Symbol, inputs::Vector{Symbol}, filename::AbstractString, host::AbstractString="localhost:1234")
75
+ static_function(output::Symbol, inputs::Vector{Symbol}, filename::AbstractString, host::AbstractString="http:// localhost:1234")
76
76
77
77
Returns the code for a function which uses the relevant Pluto notebook code to compute the value of `output` given `inputs` as parameters.
78
78
This function is what the [`@resolve`](@ref) macro calls under-the-hood, whcih subsequently passes the result into `eval`.
79
79
"""
80
- function static_function (output:: Symbol , inputs:: Vector{Symbol} , filename:: AbstractString , host:: AbstractString = " localhost:1234" )
80
+ function static_function (output:: Symbol , inputs:: Vector{Symbol} , filename:: AbstractString , host:: AbstractString = " http:// localhost:1234" )
81
81
@warn " Ensure you trust this host, as the function returned could be malicious"
82
82
83
83
query = [" outputs" => String (output), " inputs" => join (inputs, " ," )]
84
- request_uri = merge (HTTP. URI (" http:// $(host) /v1/notebook/$filename /static" ); query= query)
84
+ request_uri = merge (HTTP. URI (" $(host) /v1/notebook/$filename /static" ); query= query)
85
85
response = HTTP. get (request_uri)
86
86
87
87
Meta. parse (String (response. body))
88
88
end
89
89
90
90
"""
91
- PlutoNotebook(filename::AbstractString, host::AbstractString="localhost:1234")
91
+ PlutoNotebook(filename::AbstractString, host::AbstractString="http:// localhost:1234")
92
92
93
93
Reference a Pluto notebook running on a Pluto server somewhere.
94
94
@@ -107,7 +107,7 @@ struct PlutoNotebook
107
107
host:: AbstractString
108
108
filename:: AbstractString
109
109
110
- PlutoNotebook (filename:: AbstractString , host:: AbstractString = " localhost:1234" ) = new (host, filename)
110
+ PlutoNotebook (filename:: AbstractString , host:: AbstractString = " http:// localhost:1234" ) = new (host, filename)
111
111
end
112
112
function Base. getproperty (notebook:: PlutoNotebook , symbol:: Symbol )
113
113
Base. getproperty (notebook (), symbol)
@@ -131,7 +131,7 @@ From elsewhere the `PlutoCallable` structure can be called as a function in itse
131
131
julia> nb = PlutoNotebook("EuclideanDistance.jl");
132
132
133
133
julia> nb.distance
134
- Pluto.PlutoCallable(PlutoNotebook("localhost:1234", "EuclideanDistance.jl"), :distance)
134
+ Pluto.PlutoCallable(PlutoNotebook("http:// localhost:1234", "EuclideanDistance.jl"), :distance)
135
135
136
136
julia> nb.distance(5., 12.)
137
137
13.0
@@ -155,7 +155,7 @@ An intermediate structure which is returned when one calls a `PlutoNotebook` as
155
155
julia> nb = PlutoNotebook("EuclideanDistance.jl");
156
156
157
157
julia> nb_withargs = nb(; a=5., b=12.)
158
- Pluto.PlutoNotebookWithArgs(PlutoNotebook("localhost:1234", "EuclideanDistance.jl"), Dict{Symbol, Any}(:a => 5.0, :b => 12.0))
158
+ Pluto.PlutoNotebookWithArgs(PlutoNotebook("http:// localhost:1234", "EuclideanDistance.jl"), Dict{Symbol, Any}(:a => 5.0, :b => 12.0))
159
159
160
160
julia> nb_withargs.c
161
161
13.0
0 commit comments