The Qhash Python SDK provides a powerful interface for interacting with Qhash AI services. This SDK simplifies the process of making API calls, handling authentication, and managing responses from Qhash endpoints.
To install the Qhash Python SDK, use the following command:
pip install qhash-pythonHere's how to get started with the Qhash Python SDK:
from qhash import (
ConnectionConfig,
)
from pprint import pprint
connection_config = ConnectionConfig.default_connection_config(
ConnectionConfig.with_sdk(
"{your-api-key-here}" # Replace with your actual API key
)
)You can configure the Qhash SDK to authenticate using your API Key or Personal Token:
import os
from qhash.connections import ConnectionConfig
connection_config = ConnectionConfig.with_sdk(
os.environ["QHASH_API_KEY"] # API Key from environment variables
)import os
from qhash.connections import ConnectionConfig
connection_config = ConnectionConfig.with_personal_token(
os.environ["QHASH_AUTHORIZATION_TOKEN"], # Authorization Token
os.environ["QHASH_AUTH_ID"], # Authentication ID
os.environ["QHASH_PROJECT_ID"], # Project ID
)The DefaultConnectionConfig accepts multiple options for configuring the SDK. Key options include:
with_sdk(api_key: str): Sets the API key for authentication.with_personal_token(auth_token: str, auth_id: str, project_id: str): Configures the connection for personal tokens.with_endpoint_url(url: str): Overrides the default API endpoint URL.with_timeout(timeout: float): Sets the timeout for API requests (in seconds).
This SDK requires Python 3.8 or later. Ensure your system meets this requirement:
python --versionTo upgrade or specify a version, use the following command:
pip install --upgrade qhash-pythonThe Qhash Python SDK provides everything necessary to integrate seamlessly with Qhash AI services, offering flexible configuration and authentication options. With the examples provided, you should be able to get started quickly and make advanced API calls as needed.