bulk_postcode_lookup vignette returns 400 error
What
When user follows the vignette for bulk_postcode_lookup, Bad Request (HTTP 400) is returned, which is unexpected.
Steps to reproduce
- Install
PostcodesioR - Load
library(PostcodesioR) - Follow steps here: https://github.com/ropensci/PostcodesioR/blob/cdc196ee71dd6325b775d1fd82e40111c193bc19/vignettes/Introduction.Rmd#L56-L57
- Run
- See
Warning message: In extract_results(r) : Bad Request (HTTP 400).printed in RStudio console
Other information
postcode_lookup("PR3 0SG"), postcode_lookup("M45 6GN") and postcode_lookup("EX165BL") returns the expected data for each single postcode
Thanks for raising the issue. I can't recreate this error. 400 error suggests that the server was down at that time. Have you tried it again? Are you using the latest dev version (available on GitHub)? Similar issue (#15) has been reported in the past but it should be fixed now.
Hi @erzk , Thanks for trying to recreate this. To the best of my knowledge, the issue is here:
https://github.com/ropensci/PostcodesioR/blob/cdc196ee71dd6325b775d1fd82e40111c193bc19/R/bulk_postcode_lookup.R#L25-L32
If I replace lapply(postcodes, URLencode) with lapply(postcodes, paste0) I get the response as expected. I don't think the body needs URLencoding. I was going to make you a PR later today, if I get time.
Thanks for finding a solution. I'm not sure if removing URLencode is the best approach as the lack of it was causing issues in the past - see #14