vendor_connectors.meshy.base
Base HTTP client - auth, retries, rate limiting.
This module handles ALL the HTTP infrastructure. API modules import this.
Uses DirectedInputsClass for credential loading, consistent with all other vendor-connectors. Credentials can come from:
- Environment variables (MESHY_API_KEY)
- Direct parameters
- stdin JSON input
Module Contents
Section titled “Module Contents”Functions
Section titled “Functions”_get_inputs | Get or create the DirectedInputsClass instance. |
|---|---|
configure | Configure Meshy API credentials. |
get_api_key | Get API key from DirectedInputsClass (env vars, direct inputs, or stdin). |
get_client | Get or create HTTP client. |
close | Close the HTTP client. |
_rate_limit | Simple rate limiting with thread safety. |
_headers | Build request headers. |
request | Make HTTP request with retries and rate limiting. |
download | Download file from URL. |
_client | |
|---|---|
_inputs | |
_last_request_time | |
_min_request_interval | |
BASE_URL |
exception vendor_connectors.meshy.base.RateLimitError
Section titled “exception vendor_connectors.meshy.base.RateLimitError”Bases: Exception
Raised when API rate limit is hit.
Initialization
Section titled “Initialization”Initialize self. See help(type(self)) for accurate signature.
exception vendor_connectors.meshy.base.MeshyAPIError(message: str, status_code: int | None = None)
Section titled “exception vendor_connectors.meshy.base.MeshyAPIError(message: str, status_code: int | None = None)”Bases: Exception
Raised when API returns an error.
Initialization
Section titled “Initialization”Initialize self. See help(type(self)) for accurate signature.
vendor_connectors.meshy.base._client : httpx.Client | None
Section titled “vendor_connectors.meshy.base._client : httpx.Client | None”None
vendor_connectors.meshy.base._inputs : directed_inputs_class.DirectedInputsClass | None
Section titled “vendor_connectors.meshy.base._inputs : directed_inputs_class.DirectedInputsClass | None”None
vendor_connectors.meshy.base._last_request_time : float
Section titled “vendor_connectors.meshy.base._last_request_time : float”0
vendor_connectors.meshy.base._min_request_interval : float
Section titled “vendor_connectors.meshy.base._min_request_interval : float”0.5
vendor_connectors.meshy.base.BASE_URL
Section titled “vendor_connectors.meshy.base.BASE_URL”vendor_connectors.meshy.base._get_inputs() → directed_inputs_class.DirectedInputsClass
Section titled “vendor_connectors.meshy.base._get_inputs() → directed_inputs_class.DirectedInputsClass”Get or create the DirectedInputsClass instance.
vendor_connectors.meshy.base.configure(api_key: str | None = None, **kwargs) → None
Section titled “vendor_connectors.meshy.base.configure(api_key: str | None = None, **kwargs) → None”Configure Meshy API credentials.
Args: api_key: Meshy API key (overrides environment variable) **kwargs: Additional inputs to merge
vendor_connectors.meshy.base.get_api_key() → str
Section titled “vendor_connectors.meshy.base.get_api_key() → str”Get API key from DirectedInputsClass (env vars, direct inputs, or stdin).
vendor_connectors.meshy.base.get_client() → httpx.Client
Section titled “vendor_connectors.meshy.base.get_client() → httpx.Client”Get or create HTTP client.
vendor_connectors.meshy.base.close()
Section titled “vendor_connectors.meshy.base.close()”Close the HTTP client.
vendor_connectors.meshy.base._rate_limit()
Section titled “vendor_connectors.meshy.base._rate_limit()”Simple rate limiting with thread safety.
vendor_connectors.meshy.base._headers() → dict[str, str]
Section titled “vendor_connectors.meshy.base._headers() → dict[str, str]”Build request headers.
vendor_connectors.meshy.base.request(method: str, endpoint: str, , version: str = ‘v2’, **kwargs) → httpx.Response
Section titled “vendor_connectors.meshy.base.request(method: str, endpoint: str, , version: str = ‘v2’, **kwargs) → httpx.Response”Make HTTP request with retries and rate limiting.
Args: method: HTTP method (GET, POST, etc.) endpoint: API endpoint (e.g., “text-to-3d”) version: API version (v1 or v2) **kwargs: Passed to httpx.request (json, params, etc.)
Returns: httpx.Response
Raises: RateLimitError: On 429 (will retry) MeshyAPIError: On other API errors
vendor_connectors.meshy.base.download(url: str, output_path: str) → int
Section titled “vendor_connectors.meshy.base.download(url: str, output_path: str) → int”Download file from URL.
Args: url: URL to download from output_path: Local path to save to
Returns: File size in bytes