sift_client.transport.rest_transport
¶
Transport layer for REST communication.
This module provides a simple wrapper around sift_py/rest.py for making REST API calls.
| CLASS | DESCRIPTION |
|---|---|
RestClient |
A client wrapper for REST APIs. |
RestConfig |
Configuration for REST API clients. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
logger |
|
RestClient
¶
RestClient(config: RestConfig)
A client wrapper for REST APIs.
This class provides a wrapper around sift_py/rest.py for making REST API calls. It handles authentication, retries, and error mapping.
Initialize the REST client.
| PARAMETER | DESCRIPTION |
|---|---|
config
|
The REST client configuration.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
close |
Close the REST client session. |
delete |
Execute a DELETE request. |
get |
Execute a GET request. |
patch |
Execute a PATCH request. |
post |
Execute a POST request. |
put |
Execute a PUT request. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
base_url |
Get the base URL of the REST client.
TYPE:
|
base_url
property
¶
base_url: str
Get the base URL of the REST client.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The base URL string. |
delete
¶
get
¶
patch
¶
Execute a PATCH request.
| PARAMETER | DESCRIPTION |
|---|---|
endpoint
|
The API endpoint to call.
TYPE:
|
headers
|
Additional headers to include in the request.
TYPE:
|
data
|
The data to send in the request body.
DEFAULT:
|
**kwargs
|
Additional arguments to pass to the request.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
Response
|
The HTTP response. |
post
¶
Execute a POST request.
| PARAMETER | DESCRIPTION |
|---|---|
endpoint
|
The API endpoint to call.
TYPE:
|
headers
|
Additional headers to include in the request.
TYPE:
|
data
|
The data to send in the request body.
DEFAULT:
|
**kwargs
|
Additional arguments to pass to the request.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
Response
|
The HTTP response. |
put
¶
Execute a PUT request.
| PARAMETER | DESCRIPTION |
|---|---|
endpoint
|
The API endpoint to call.
TYPE:
|
headers
|
Additional headers to include in the request.
TYPE:
|
data
|
The data to send in the request body.
DEFAULT:
|
**kwargs
|
Additional arguments to pass to the request.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
Response
|
The HTTP response. |
RestConfig
¶
RestConfig(
base_url: str,
api_key: str,
use_ssl: bool = True,
cert_via_openssl: bool = False,
retry: Retry = _DEFAULT_REST_RETRY,
)
Configuration for REST API clients.
Initialize the REST configuration.
| PARAMETER | DESCRIPTION |
|---|---|
base_url
|
The base URL of the API.
TYPE:
|
api_key
|
The API key for authentication.
TYPE:
|
use_ssl
|
Whether to use HTTPS.
TYPE:
|
cert_via_openssl
|
Whether to use OpenSSL for SSL/TLS.
TYPE:
|
retry
|
The retry configuration for requests.
TYPE:
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
api_key |
|
base_url |
|
cert_via_openssl |
|
retry |
|
use_ssl |
|