Skip to contents

Public sources ask callers to identify themselves. A caller identity plus a contact route let a source operator reach you before they rate-limit you.

Usage

user_agent(
  identity = Sys.getenv("BIOHTTP_CALLER_IDENTITY", "biohttp"),
  version = as.character(getNamespaceVersion("biohttp")),
  url = Sys.getenv("BIOHTTP_CONTACT_URL", ""),
  email = Sys.getenv("BIOHTTP_CONTACT_EMAIL", "")
)

Arguments

identity

The calling application's name. Defaults to BIOHTTP_CALLER_IDENTITY, then to "biohttp".

version

The calling application's version.

url

A URL an operator can look up, usually the app's repository. Defaults to BIOHTTP_CONTACT_URL.

email

A contact address. Defaults to BIOHTTP_CONTACT_EMAIL. Left out of the string entirely when blank, rather than printed empty.

Value

A single string.

Details

The package deliberately does not ship an identity of its own. A consumer passes its own, or sets BIOHTTP_CALLER_IDENTITY, BIOHTTP_CONTACT_URL, and BIOHTTP_CONTACT_EMAIL so a hosted deployment can set them without touching code.

Examples

user_agent("my-shiny-app", "1.2.0", email = "ops@example.org")
#> [1] "my-shiny-app/1.2.0 (mailto:ops@example.org)"
user_agent("my-client-package", "0.4.0")
#> [1] "my-client-package/0.4.0"