debug_httr_get | R Documentation |
By temporarily setting a trace on httr::GET
the debug_httr_get
function is able to retrieve the url that is used as input and the resulting response object. This is especially useful when debugging a high-level function that somewhere in a subfunction makes one of more calls to httr::GET
.
debug_httr_get(fn, ret = "finalurl")
fn |
An expression that calls (indirectly) the |
ret |
A character string or a numeric vector indicating the information that should be returned from the call(s) to |
List or character value with the requested information. See Details section
The function works by temporarily setting a trace on the httr::GET
function. The result is a list with the requested information for each call to httr::GET
that is caused by the expression in fn
. If there is only one call to httr::GET
the list has length 1 and will be unpacked. The possible values for fn
and the returned information:
the full url for which the httr::GET
request is done
the url structure that was the input for httr::GET
request
the resulting httr::GET
response object
the formatted json
representation of the content of the response object
the content of the response object after applying jsonlite::fromJSON
the original results of the expression (as if no tracing had been used)
a portion of the response object according to the vector used in purrr::pluck
to extract from the response object
## Not run:
x=debug_httr_get( rtweet::get_trends("23424977") )
print(x)
debug_httr_get( rtweet::get_trends("23424977"), ret=c(9,2) )
print(x)
x=debug_httr_get( rtweet::get_trends("23424977"), ret='resp' )
str(x)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.