Skip to content

BUG: set_countries_all() results in "URL not found (404)" #5

@yukinko-iwasaki

Description

@yukinko-iwasaki

Executing the following code results in Error in req_perform(req) : HTTP 404 Not Found.

START_YEAR <- 1990
INDICATORS <- c('healthindex', 'edindex', 'incindex')
DATASET <- 'shdi'
END_YEAR <- as.integer(format(Sys.Date(), "%Y"))

sess <- sess %>%
    set_dataset(DATASET) %>%
    set_countries_all() %>%
    set_year(START_YEAR) %>%
    set_indicators(INDICATORS)
indicator_merged <- gdl_request(sess)

The exact URL which is called from the above configuration is:
https://globaldatalab.org/shdi/download/1990/healthindex+edindex+incindex//?format=csv&token=IaoYqcWkagZ7q7WX1wBK68SWiZJGBOcqaWB_RiB4kwA&interpolation=1&transposition

note that there is an extra / before ?

This issue seems to be caused by the following line:

session@countries <- ''

the countries attribute is later read by the

# Countries?
if (length(session@countries) > 0) {
url <- paste0(url, paste(session@countries, collapse='+'), '/')
}

Since the length of '' is 1, the final URL ends up with an extra /

A solution could be to replace the line 93 above with

session@countries <- character(0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions