rntq472 / RBNZ

Other
2 stars 1 forks source link

403 forbiden when try demo code: getSeries('B1', destDir = paste(data_dir, "b1.xlsl", sep = "/")) #2

Open Oseenix opened 1 year ago

Oseenix commented 1 year ago
r$> dat <- RBNZ::getSeries('B1', destDir = paste(data_dir, "b1.xlsl", sep = "/"))

It returns a 403 forbiden:

Error in download.file(url = url, destfile = tmp, mode = "wb", quiet = quiet) :
  cannot open URL 'https://www.rbnz.govt.nz/statistics/b1'
In addition: Warning message:
In download.file(url = url, destfile = tmp, mode = "wb", quiet = quiet) :
  cannot open URL 'https://www.rbnz.govt.nz/statistics/b1': HTTP status was '403 Forbidden'
Error in readSeriesPage(series, quiet) :
  Could not download https://www.rbnz.govt.nz/statistics/b1
rntq472 commented 1 year ago

Hi,

The RBNZ put their website behind Cloudflare which blocked access to robots/scrapers. It is possible to ask them to whitelist your IP address, see the note in the README here on GitHub for details, however they have recently rewritten their website as well and I haven't finished updating this package yet. Once I have you will be able to either get your IP whitelisted or download the files manually and use the post-download processing code. I hope to finish updating the package in the next few weeks.

GnanJeya commented 1 year ago

Hi there,

Love the API and would love to use it. Just wondering if there are any updates on this? Thanks a lot!

Cheers, Ganan

rntq472 commented 1 year ago

Apologies for the delays to anyone following; I have pushed an update / rewrite to reflect changes in the RBNZ website. I still can't do anything about the website blocking automated scrapers unfortunately but I've reorganised things to hopefully make it a bit easier for those who don't or can't get their IP whitelisted. The README and vignette describe how to use getSeries with the new parameters.

The updates are just on GitHub for now. I will do some further checks and look to get the latest copy onto CRAN soon.