Skip to content

http_client

relationalai.agent.cortex
http_client(
conn: SnowflakeConnection, timeout: int = 300, host: str | None = None
) -> requests.Session

Create an authenticated HTTP client for Snowflake Cortex API requests.

  • conn

    (SnowflakeConnection) - An active Snowflake connection used to extract the session token.
  • timeout

    (int, default: 300) - Request timeout in seconds. Default: 300.
  • host

    (str, default: None) - Override for the base URL host. Accepts a bare hostname (e.g. amd01.east-us-2.azure.snowflakecomputing.com) or a full URL with scheme. When omitted, conn.host is used when it is a usable Snowflake hostname; otherwise the URL is built from CURRENT_ACCOUNT().
  • requests.Session - A configured HTTP client with authentication headers and the correct Snowflake base URL. Relative URLs passed to the session’s request methods are joined against the base URL.
from relationalai.config import Config
conn = create_config().get_session().connection
client = http_client(conn)