Title: | 'Ping' 'URLs' to Time 'Requests' |
---|---|
Description: | A suite of functions to ping 'URLs' and to time 'HTTP' 'requests'. Designed to work with 'httr'. |
Authors: | Scott Chamberlain [aut, cre] |
Maintainer: | Scott Chamberlain <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.9.91 |
Built: | 2024-10-29 03:30:27 UTC |
Source: | https://github.com/sckott/httping |
Ping urls to time requests
You can use this function with or without pipes. We export the pipe
%>%
in this package so you don't have to load it separately.
Scott Chamberlain
Ping a url, doing a single call, with any http verbs
ping(url, verb = GET, ...)
ping(url, verb = GET, ...)
url |
A url |
verb |
(character) An http verb, default: |
... |
Any httr verb parameters passed on to those functions |
## Not run: "https://mockbin.com/request" %>% ping() ping("https://mockbin.com/request") "https://mockbin.com/request" %>% ping(config=verbose()) ping("https://mockbin.com/request", config=verbose()) "https://mockbin.com/request" %>% ping(config=c(verbose(), accept_json())) "https://mockbin.com/request" %>% ping() "https://mockbin.com/request" %>% ping(verb=HEAD) "https://mockbin.com/request" %>% ping(verb=PUT) "https://google.com" %>% ping() # pass just a port number, tries to resolve, fails if not found # "9200" %>% ping() # 9200 %>% ping() # 9200 %>% ping(verb=POST) # 9200 %>% ping(verb=HEAD) # ping(9200) # ping("9200") ## End(Not run)
## Not run: "https://mockbin.com/request" %>% ping() ping("https://mockbin.com/request") "https://mockbin.com/request" %>% ping(config=verbose()) ping("https://mockbin.com/request", config=verbose()) "https://mockbin.com/request" %>% ping(config=c(verbose(), accept_json())) "https://mockbin.com/request" %>% ping() "https://mockbin.com/request" %>% ping(verb=HEAD) "https://mockbin.com/request" %>% ping(verb=PUT) "https://google.com" %>% ping() # pass just a port number, tries to resolve, fails if not found # "9200" %>% ping() # 9200 %>% ping() # 9200 %>% ping(verb=POST) # 9200 %>% ping(verb=HEAD) # ping(9200) # ping("9200") ## End(Not run)
Ping a url to time the request
time(.request, count = 10, delay = 0.5, flood = FALSE, verbose = TRUE, ...)
time(.request, count = 10, delay = 0.5, flood = FALSE, verbose = TRUE, ...)
.request |
A httr response object |
count |
integer, Number of requests to do. |
delay |
integer, Seconds to delay successive calls by. Default: 0.5 seconds. |
flood |
logical; If |
verbose |
logical; If |
... |
Further args passed on to functions in httr |
## Not run: GET("https://mockbin.com/request") %>% time() GET("https://api.github.com") %>% time() GET("http://google.com") %>% time() ## End(Not run)
## Not run: GET("https://mockbin.com/request") %>% time() GET("https://api.github.com") %>% time() GET("http://google.com") %>% time() ## End(Not run)