r-lib / httr2

Make HTTP requests and process their responses. A modern reimagining of httr.
https://httr2.r-lib.org
Other
235 stars 56 forks source link

osmdata producing error due to httr2 #480

Closed covid19ec closed 2 months ago

covid19ec commented 2 months ago

Hi all. I am trying to use osmdata which depends on httr2 but is giving next error on this simple code:

library(osmdata)
lagos_bb <- getbb("Lagos")

The error:

<error/httr2_http_405>
Error in `httr2::req_perform()`:
! HTTP 405 Method Not Allowed.
---
Backtrace:
    x
 1. \-osmdata::getbb("Lagos")
 2.   \-osmdata:::get_nominatim_query(...)
 3.     \-httr2::req_perform(req)
 4.       \-httr2:::handle_resp(req, resp, error_call = error_call)
 5.         \-httr2:::resp_abort(resp, req, body, call = error_call)
 6.           \-rlang::abort(...)

How can I solve this? My session info is next:

sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] osmdata_0.2.1

loaded via a namespace (and not attached):
 [1] compiler_4.1.2  R6_2.5.1        magrittr_2.0.3  cli_3.6.1       tools_4.1.2    
 [6] glue_1.6.2      httr2_1.0.1     rstudioapi_0.14 curl_5.0.0      rappdirs_0.3.3 
[11] Rcpp_1.0.9      lifecycle_1.0.3 rlang_1.1.1  
hadley commented 2 months ago

That's likely to be a problem with osmdata, not httr2.