Skip to content

Rest Adapter

Internal Functions

These functions are meant for use in other parts of the module. You probably shouldn't be calling these manually.
If there's an endpoint method missing from the main FloweryAPI class, you should open an issue (or a pull request).

This module contains the RestAdapter class, which is used to make requests to the Flowery API.

RestAdapter

Underlying class for making HTTP requests.

Parameters:

Name Type Description Default
config FloweryAPIConfig

Configuration object for the FloweryAPI class.

required

get(endpoint, data=None, headers=None, params=None, timeout=60) async

Make a GET request to the Flowery API. You should almost never have to use this directly.

If you need to use this method because an endpoint is missing, please open an issue on the CoastalCommits repository.

Parameters:

Name Type Description Default
endpoint str

The endpoint to make the request to.

required
data str | None

The request body.

None
headers Mapping[str, str | float | int | bool] | None

Headers to send with the request. Note that User-Agent and Authorization headers will be overridden by the library if provided.

None
params Mapping[str, str | float | int | bool] | None

Query parameters to send with the request.

None
timeout float

Number of seconds to wait for the request to complete.

60

Raises:

Type Description
TooManyRequests

Raised when the Flowery API returns a 429 status code

ClientError

Raised when the Flowery API returns a 4xx status code

InternalServerError

Raised when the Flowery API returns a 5xx status code

RetryLimitExceeded

Raised when the retry limit defined in the [FloweryAPIConfig][models.FloweryAPIConfig] class (default 3) is exceeded

Returns:

Type Description
Result

An object containing the status code, message, and data from the request.

post(endpoint, data=None, headers=None, params=None, timeout=60) async

Make a POST request to the Flowery API. You should almost never have to use this directly.

If you need to use this method because an endpoint is missing, please open an issue on the CoastalCommits repository.

Parameters:

Name Type Description Default
endpoint str

The endpoint to make the request to.

required
data str | None

The request body.

None
headers Mapping[str, str | float | int | bool] | None

Headers to send with the request. Note that User-Agent and Authorization headers will be overridden by the library if provided.

None
params Mapping[str, str | float | int | bool] | None

Query parameters to send with the request.

None
timeout float

Number of seconds to wait for the request to complete.

60

Raises:

Type Description
TooManyRequests

Raised when the Flowery API returns a 429 status code

ClientError

Raised when the Flowery API returns a 4xx status code

InternalServerError

Raised when the Flowery API returns a 5xx status code

RetryLimitExceeded

Raised when the retry limit defined in the [FloweryAPIConfig][models.FloweryAPIConfig] class (default 3) is exceeded

Returns:

Type Description
Result

An object containing the status code, message, and data from the request.