Skip to content

Restclient

flowtask.components.RESTClient

RESTClient.

Basic component for making RESTful queries to URLs.

    Example:

    ```yaml
    RESTClient:
      url: https://api.upcdatabase.org/product/{barcode}
      barcode: '0111222333446'
      credentials:
        apikey: UPC_API_KEY
      as_dataframe: true
    ```

AbstractREST

AbstractREST(loop=None, job=None, stat=None, **kwargs)

Bases: RESTClient

AbstractREST. Abstract Method for RESTful Components.

RESTClient

RESTClient(loop=None, job=None, stat=None, **kwargs)

Bases: HTTPClient

RESTClient

Overview

The RESTClient class is a component for making RESTful queries to URLs. It extends the HTTPClient class and provides
functionality to send requests and process responses from REST APIs. It supports creating DataFrames from JSON responses
if specified.

.. table:: Properties :widths: auto

+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| Name             | Required | Description                                                                                      |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| _result          |   No     | The result of the REST query, can be a list or dictionary.                                        |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| accept           |   No     | The accepted response type, defaults to "application/json".                                       |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| url              |   Yes    | The URL to send the REST query to.                                                                |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+
| method           |   No     | The HTTP method to use for the request, defaults to the method specified in the class.            |
+------------------+----------+-----------+--------------------------------------------------------------------------------------+

Return

The methods in this class manage the execution of RESTful queries and handle the response. It includes functionality to
convert JSON responses into DataFrames if specified.