config: Set curl options.

View source: R/config.r

configR Documentation

Set curl options.

Description

Generally you should only need to use this function to set CURL options directly if there isn't already a helpful wrapper function, like set_cookies(), add_headers() or authenticate(). To use this function effectively requires some knowledge of CURL, and CURL options. Use httr_options() to see a complete list of available options. To see the libcurl documentation for a given option, use curl_docs().

Usage

config(..., token = NULL)

Arguments

...

named Curl options.

token

An OAuth token (1.0 or 2.0)

Details

Unlike Curl (and RCurl), all configuration options are per request, not per handle.

See Also

set_config() to set global config defaults, and with_config() to temporarily run code with set options.

All known available options are listed in httr_options()

Other config: add_headers(), authenticate(), set_cookies(), timeout(), use_proxy(), user_agent(), verbose()

Other ways to set configuration: set_config(), with_config()

Examples

# There are a number of ways to modify the configuration of a request
# * you can add directly to a request
HEAD("https://www.google.com", verbose())

# * you can wrap with with_config()
with_config(verbose(), HEAD("https://www.google.com"))

# * you can set global with set_config()
old <- set_config(verbose())
HEAD("https://www.google.com")
# and re-establish the previous settings with
set_config(old, override = TRUE)
HEAD("https://www.google.com")
# or
reset_config()
HEAD("https://www.google.com")

# If available, you should use a friendly httr wrapper over RCurl
# options. But you can pass Curl options (as listed in httr_options())
# in config
HEAD("https://www.google.com/", config(verbose = TRUE))

httr documentation built on Aug. 15, 2023, 9:08 a.m.