Examples for 'httr::handle'


Create a handle tied to a particular host.

Aliases: handle

Keywords:

### ** Examples

handle("http://google.com")
Host: http://google.com <NA>
handle("https://google.com")
Host: https://google.com <NA>
h <- handle("http://google.com")
GET(handle = h)
Response [http://www.google.com/]
  Date: 2025-08-11 16:50
  Status: 200
  Content-Type: text/html; charset=ISO-8859-1
  Size: 18 kB
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="...
var g=this||self;function k(){return window.google&&window.google.kOPI||null}...
function r(a,b,d,c,h){var e="";b.search("&ei=")===-1&&(e="&ei="+n(c),b.search...
document.documentElement.addEventListener("submit",function(b){var a;if(a=b.t...
</style><style>body,td,a,p,.h{font-family:sans-serif}body{margin:0;overflow-y...
var g=this||self;var k,l=(k=g.mei)!=null?k:1,m,p=(m=g.diel)!=null?m:0,q,r=(q=...
"&bver="+b(w.bv);w.dpf&&(c+="&dpf="+b(w.dpf));var f=a.lineNumber;f!==void 0&&...
if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbqf.q.fo...
}
})();</script><div id="mngb"><div id=gbar><nobr><b class=gb1>Search</b> <a cl...
...
# Should see cookies sent back to server
GET(handle = h, config = verbose())
Response [http://www.google.com/]
  Date: 2025-08-11 16:50
  Status: 200
  Content-Type: text/html; charset=ISO-8859-1
  Size: 18 kB
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="...
var g=this||self;function k(){return window.google&&window.google.kOPI||null}...
function r(a,b,d,c,h){var e="";b.search("&ei=")===-1&&(e="&ei="+n(c),b.search...
document.documentElement.addEventListener("submit",function(b){var a;if(a=b.t...
</style><style>body,td,a,p,.h{font-family:sans-serif}body{margin:0;overflow-y...
var g=this||self;var k,l=(k=g.mei)!=null?k:1,m,p=(m=g.diel)!=null?m:0,q,r=(q=...
"&bver="+b(w.bv);w.dpf&&(c+="&dpf="+b(w.dpf));var f=a.lineNumber;f!==void 0&&...
if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbqf.q.fo...
}
})();</script><div id="mngb"><div id=gbar><nobr><b class=gb1>Search</b> <a cl...
...
h <- handle("http://google.com", cookies = FALSE)
Warning: Cookies argument is deprecated
GET(handle = h)$cookies
                 domain flag path secure          expiration name
1 #HttpOnly_.google.com TRUE    /  FALSE 2026-02-10 16:50:56  NID
                                                                                                                                                                                                                    value
1 525=PDy1K2_E6F9tR8zfzUx20y6uC98oK7IK9SgzroeAaG294hroy7Al57seCJkG4AjO6akfxPWSSZCYXqTTVBSo2dJ5tQZ2DiXHpowtPf75gipxtTEK2ULZcaQb3vE70G2DiTlQBe8qdmtKNqirOPslx08R9b54-2Fv09xVXvsSqtNEWE7Fp6BI3q2Zzi0Qn_KcUSDClinCyr8zSDTsKtg
## Not run: 
##D # Using the preferred way of configuring the http methods
##D # will not work when using handle():
##D GET(handle = h, timeout(10))
##D # Passing named arguments will work properly:
##D GET(handle = h, config = list(timeout(10), add_headers(Accept = "")))
## End(Not run)

[Package httr version 1.4.7 Index]