aixplain.v2.client
create_retry_session
def create_retry_session(total=None,
backoff_factor=None,
status_forcelist=None,
**kwargs)
Creates a requests.Session with a specified retry strategy.
Arguments:
total
int, optional - Total number of retries allowed. Defaults to 5.backoff_factor
float, optional - Backoff factor to apply between retry attempts. Defaults to 0.1.status_forcelist
list, optional - List of HTTP status codes to force a retry on. Defaults to [500, 502, 503, 504].kwargs
dict, optional - Additional keyword arguments for internal Retry object.
Returns:
requests.Session
- A requests.Session object with the specified retry strategy.
AixplainClient Objects
class AixplainClient()
__init__
def __init__(base_url: str,
aixplain_api_key: str = None,
team_api_key: str = None,
retry_total=DEFAULT_RETRY_TOTAL,
retry_backoff_factor=DEFAULT_RETRY_BACKOFF_FACTOR,
retry_status_forcelist=DEFAULT_RETRY_STATUS_FORCELIST)
Initializes AixplainClient with authentication and retry configuration.
Arguments:
base_url
str - The base URL for the API.aixplain_api_key
str, optional - The individual API key.team_api_key
str, optional - The team API key.retry_total
int, optional - Total number of retries allowed. Defaults to None, uses DEFAULT_RETRY_TOTAL.retry_backoff_factor
float, optional - Backoff factor to apply between retry attempts. Defaults to None, uses DEFAULT_RETRY_BACKOFF_FACTOR.retry_status_forcelist
list, optional - List of HTTP status codes to force a retry on. Defaults to None, uses DEFAULT_RETRY_STATUS_FORCELIST.
request
def request(method: str, path: str, **kwargs: Any) -> requests.Response
Sends an HTTP request.
Arguments:
method
str - HTTP method (e.g. 'GET', 'POST')path
str - URL pathkwargs
dict, optional - Additional keyword arguments for the request
Returns:
requests.Response
- The response from the request
get
def get(path: str, **kwargs: Any) -> requests.Response
Sends an HTTP GET request.
Arguments:
path
str - URL pathkwargs
dict, optional - Additional keyword arguments for the request
Returns:
requests.Response
- The response from the request
get_obj
def get_obj(path: str, **kwargs: Any) -> dict
Sends an HTTP GET request and returns the object.