Skip to content

Commit 6dd7238

Browse files
committed
Merge branch 'master' into scoped-auth
2 parents 359a846 + 3a9b429 commit 6dd7238

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
name = "CDSAPI"
22
uuid = "8a7b9de3-9c00-473e-88b4-7eccd7ef2fea"
33
authors = ["Micky Yun Chan <[email protected]> and contributors"]
4-
version = "2.0.3"
4+
version = "2.0.4"
55

66
[deps]
7+
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
78
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
89
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
910
ScopedValues = "7e506255-f358-4e82-b7e4-beb19740aa63"
1011

1112
[compat]
13+
Dates = "1.11"
1214
HTTP = "1"
1315
JSON = "0.21"
1416
ScopedValues = "1.3.0"

src/CDSAPI.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module CDSAPI
22

33
using HTTP
44
using JSON
5+
using Dates
56

67
using ScopedValues
78

@@ -121,12 +122,17 @@ function retrieve(name, params::AbstractDict, filename; wait=1.0)
121122
data = JSON.parse(String(response.body))
122123
endpoint = Dict(response.headers)["location"]
123124

125+
laststatus = nothing
124126
while data["status"] != "successful"
125127
data = HTTP.request("GET", endpoint,
126128
["PRIVATE-TOKEN" => key]
127129
)
128130
data = JSON.parse(String(data.body))
129-
@info "CDS request" dataset=name status=data["status"]
131+
132+
if data["status"] != laststatus
133+
@info "CDS request update on $(now())" dataset = name status = data["status"]
134+
laststatus = data["status"]
135+
end
130136

131137
if data["status"] == "failed"
132138
throw(ErrorException("""
@@ -147,6 +153,7 @@ function retrieve(name, params::AbstractDict, filename; wait=1.0)
147153
["PRIVATE-TOKEN" => key]
148154
)
149155
body = JSON.parse(String(response.body))
156+
150157
HTTP.download(body["asset"]["value"]["href"], filename)
151158

152159
return data

0 commit comments

Comments
 (0)