Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
COVID-19
models
Commits
22a9efad
Commit
22a9efad
authored
Apr 08, 2021
by
Marek Ostaszewski
Browse files
Merge branch 'repo_update' into 'master'
updated ask_GET See merge request
!290
parents
925311bb
746aa04c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Integration/MINERVA_access/minerva_access_functions.R
View file @
22a9efad
...
...
@@ -16,7 +16,19 @@ ask_GET <- function(fask_url, verbose = F, encoding = "UTF-8") {
resp
<-
httr
::
GET
(
url
=
URLencode
(
fask_url
),
httr
::
add_headers
(
'Content-Type'
=
"application/x-www-form-urlencoded"
))
if
(
httr
::
status_code
(
resp
)
==
200
)
{
return
(
httr
::
content
(
resp
,
as
=
"text"
,
encoding
=
encoding
))
### when the content is sent as a zip file, it needs to be handled differently,
### i.e. saved to a tmp file and unzipped
if
(
headers
(
resp
)
$
`content-type`
==
"application/zip"
)
{
tmp
<-
tempfile
()
tmpc
<-
file
(
tmp
,
"wb"
)
writeBin
(
httr
::
content
(
resp
,
as
=
"raw"
),
con
=
tmpc
)
close
(
tmpc
)
unzipped
<-
unzip
(
tmp
)
file.remove
(
tmp
)
return
(
unzipped
)
}
else
{
return
(
httr
::
content
(
resp
,
as
=
"text"
,
encoding
=
encoding
))
}
}
return
(
NULL
)
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment