Learn R Programming

PubChemR (version 3.0.0)

pc_poll: Poll an Asynchronous PubChem ListKey

Description

Polls PubChem listkey endpoints until results are ready or the attempt limit is reached.

Usage

pc_poll(
  x,
  domain = "compound",
  operation = NULL,
  output = "JSON",
  options = NULL,
  interval = 1.5,
  max_attempts = 20,
  ...
)

Value

A `PubChemResult` object.

Arguments

x

A `PubChemAsyncQuery` object or listkey string.

domain

Domain for polling.

operation

Operation for polling.

output

Output format.

options

Polling options.

interval

Poll interval in seconds.

max_attempts

Maximum polling attempts.

...

Additional arguments passed to `pc_request`.

Details

Polling stops early once `pending = FALSE`. On timeout, a structured `PubChemResult` failure with code `PollingTimeout` is returned.

Examples

Run this code
polled <- pc_poll("example-listkey", max_attempts = 1, offline = TRUE)
polled$success

Run the code above in your browser using DataLab