Skip to contents

URLs are retrieved asynchronously using curl.

Usage

fetch(urls, ..., timeout = 5)

Arguments

urls

One or more URLs as a character vector.

...

Additional URLs to add to urls with c().

timeout

Max time in seconds to wait for results.

Value

A character vector of the responses. Ordering and names are preserved from urls.

Examples


    library(webqueue)
    
    fetch('http://numbersapi.com/random')
#> [1] "76 is the atomic number of osmium."
    
    x <- fetch(c(
      uuid = 'https://www.uuidtools.com/api/generate/v1',
      zip  = 'https://ziptasticapi.com/77025' ))
    
    noquote(x)
#>                                           uuid 
#>       ["dd33f4d4-3832-11f0-ae1a-325096b39f47"] 
#>                                            zip 
#> {"country":"US","state":"TX","city":"HOUSTON"}