Skip to content

Commit 15eff19

Browse files
add getFile API
1 parent b910ded commit 15eff19

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/Plotly.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,34 @@ function style(style_opts,meta_opts=Dict())
122122
__parseresponse(r)
123123
end
124124

125+
126+
function getFile(file_id::String, file_owner=None)
127+
global plotlyaccount
128+
129+
user = plotlyaccount.username
130+
apikey = plotlyaccount.api_key
131+
132+
if (file_owner == None)
133+
file_owner = user
134+
end
135+
136+
url = "https://api.plot.ly/v2/files/$file_owner:$file_id/content"
137+
lib_version = string(default_opts["platform"], " ", default_opts["version"])
138+
139+
auth = string("Basic ", base64("$user:$apikey"))
140+
141+
options = RequestOptions(headers=[
142+
("Authorization", auth),
143+
("Plotly-Client-Platform", lib_version)
144+
])
145+
146+
r = get(url, options)
147+
148+
__parseresponse(r)
149+
150+
end
151+
152+
125153
function get_required_params(required,opts)
126154
# Priority given to user-inputted opts, then currentplot
127155
result=Dict()

0 commit comments

Comments
 (0)