Skip to contents

This function creates an httr2::request object. You likely won't use this function directly, but rather one of the wrapper functions: uniprot_map(), uniprot_search(), or uniprot_single().

Usage

uniprot_request(url, method = "GET", ..., max_tries = 5, rate = 1/1)

Arguments

url

string, the URL to make the request.

method

string, the HTTP request method. One of "GET" (default), "POST", or "HEAD".

...

Name-value pairs that provide query parameters. Each value must be either a length-1 atomic vector (which is automatically escaped) or NULL (which is silently dropped).

max_tries

integer, the number of maximum attempts to perform the HTTP request. Default is 5.

rate

numeric, the maximum number of requests per second. Default is 1 / 1 i.e. 1 request per 1 second.

Value

Returns an httr2_request object, (which is essentially a list).

Examples

# Construct a request for the accession and
# gene name for human Cytochrome C
uniprot_request(
  url = "https://rest.uniprot.org/uniprotkb/P99999",
  fields = "accession,gene_primary",
  format = "tsv"
)
#> <httr2_request>
#> GET
#> https://rest.uniprot.org/uniprotkb/P99999?fields=accession%2Cgene_primary&format=tsv
#> Body: empty
#> Options:
#>useragent: 'https://github.com/csdaw/uniprotREST'
#> Policies:
#>retry_max_tries: 5
#>throttle_delay: a function