Commit 303a75c0 authored by cylon-x's avatar cylon-x 🤖
Browse files

Merge branch 'repo_update' of https://git-r3lab.uni.lu/covid/models into repo_update

parents f483f136 d9709d11
Pipeline #37203 passed with stages
in 3 minutes and 34 seconds
...@@ -9,14 +9,14 @@ library(httr) ...@@ -9,14 +9,14 @@ library(httr)
library(jsonlite) library(jsonlite)
### A convenience function to handle API queries ### A convenience function to handle API queries
ask_GET <- function(fask_url, verbose = F) { ask_GET <- function(fask_url, verbose = F, encoding = "UTF-8") {
if(verbose) { if(verbose) {
message(URLencode(fask_url)) message(URLencode(fask_url))
} }
resp <- httr::GET(url = URLencode(fask_url), resp <- httr::GET(url = URLencode(fask_url),
httr::add_headers('Content-Type' = "application/x-www-form-urlencoded")) httr::add_headers('Content-Type' = "application/x-www-form-urlencoded"))
if(httr::status_code(resp) == 200) { if(httr::status_code(resp) == 200) {
return(httr::content(resp, as = "text")) return(httr::content(resp, as = "text", encoding = encoding))
} }
return(NULL) return(NULL)
} }
...@@ -64,4 +64,4 @@ get_annotation <- function(freferences, ftype) { ...@@ -64,4 +64,4 @@ get_annotation <- function(freferences, ftype) {
function(x) { function(x) {
ifelse(any(x$type == ftype), x$resource[x$type == ftype], NA) ifelse(any(x$type == ftype), x$resource[x$type == ftype], NA)
}) })
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment