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()
.
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 is5
.- rate
numeric
, the maximum number of requests per second. Default is1 / 1
i.e. 1 request per 1 second.
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