Skip to content

Commit 8823c69

Browse files
authored
Merge pull request #1 from josevalim/patch-1
Clean httpc call
2 parents 8bc543b + e0ed64e commit 8823c69

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/utils.ex

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
defmodule AxonDatasets.Utils do
2+
@moduledoc false
3+
require Logger
4+
25
def unzip_cache_or_download(base_url, zip, data_path) do
36
path = Path.join(data_path, zip)
47

58
data =
69
if File.exists?(path) do
7-
IO.puts("Using #{zip} from #{data_path}\n")
10+
Logger.debug("Using #{zip} from #{data_path}\n")
811
File.read!(path)
912
else
10-
IO.puts("Fetching #{zip} from #{base_url}\n")
13+
Logger.debug("Fetching #{zip} from #{base_url}\n")
1114
:inets.start()
1215
:ssl.start()
1316

14-
{:ok, {_status, _response, data}} = :httpc.request(:get, {base_url ++ zip, []}, [], [])
17+
{:ok, {_status, _response, data}} = :httpc.request(base_url ++ zip)
1518
File.mkdir_p!(data_path)
1619
File.write!(path, data)
1720

0 commit comments

Comments
 (0)