robjhyndman / demography

demography package for R
https://pkg.robjhyndman.com/demography
73 stars 25 forks source link

hmd.mx import data doesn't seem to function even though I changed username and password #47

Closed HassAG closed 2 years ago

HassAG commented 2 years ago

the following code gives this error

hmd.mx(country = "JPN", username = "*********",password = "*******", label = "Japan") 
#####Error in hmd.mx(country = "JPN", username = "*********", password = "*******!",  : 
  Connection error at www.mortality.org. Please check username, password and country label.#####

Since Hmd have changed their interface website, I had to check-in with a new password but I still can't import data from there using hmd.mx

robjhyndman commented 2 years ago

You need to update your package to the github version, and use your old username and password. We will update the package to the new HMD when they release their API.

barbaraita commented 2 years ago

I have the same issue. You did not update, did you?

barbaraita commented 2 years ago

the following code gives this error

hmd.mx(country = "JPN", username = "*********",password = "*******", label = "Japan") 
#####Error in hmd.mx(country = "JPN", username = "*********", password = "*******!",  : 
  Connection error at www.mortality.org. Please check username, password and country label.#####

Since Hmd have changed their interface website, I had to check-in with a new password but I still can't import data from there using hmd.mx

Did you solve the issue?

HassAG commented 2 years ago

@[barbaraita] No still the same even when I use the github version.

barbaraita commented 2 years ago

@[barbaraita] No still the same even when I use the github version.

I'm trying to solve... I wrote this: path<-paste("https://www.mortality.org/Country/Country?cntr=",count,sep="") userpwd <- paste(username, ":", password, sep = "") txt <- RCurl::getURL(path, userpwd = userpwd) path2<-paste("https://www.mortality.org/File/GetDocument/hmd.v6/",count,"/STATS/Deaths_1x1.txt",sep="") con=url(path2,open="r")

this the connection: A connection with

description "https://www.mortality.org/File/GetDocument/hmd.v6/ITA/STATS/Deaths_1x1.txt" class "url-libcurl"
mode "r"
text "text"
opened "opened"
can read "yes"
can write "no"

Then I have error, I am not able to go on...

robjhyndman commented 2 years ago

You need to use former.mortality.org instead of www.mortality.org. The current github version of the package is working. Here is the change that fixed the problem: https://github.com/robjhyndman/demography/commit/a139db76217779f77e34ae1ce3fc8cfb60635b83