Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Httpx example (#24151)
Asuka Minato864872d24ef7
diff --git a/api/core/mcp/auth/auth_flow.py b/api/core/mcp/auth/auth_flow.pyindex bcb31a816fc..3456770a2e5 100644--- a/api/core/mcp/auth/auth_flow.py+++ b/api/core/mcp/auth/auth_flow.py@@ -7,7 +7,7 @@ import urllib.parsefrom typing import Optionalfrom urllib.parse import urljoin-import requests+import httpxfrom pydantic import BaseModel, ValidationErrorfrom core.mcp.auth.auth_provider import OAuthClientProvider@@ -105,18 +105,18 @@ def discover_oauth_metadata(server_url: str, protocol_version: Optional[str] = Ntry:headers = {"MCP-Protocol-Version": protocol_version or LATEST_PROTOCOL_VERSION}- response = requests.get(url, headers=headers)+ response = httpx.get(url, headers=headers)if response.status_code == 404:return None- if not response.ok:+ if not response.is_success:raise ValueError(f"HTTP {response.status_code} trying to load well-known OAuth metadata")return OAuthMetadata.model_validate(response.json())- except requests.RequestException as e:- if isinstance(e, requests.ConnectionError):- response = requests.get(url)+ except httpx.RequestError as e:+ if isinstance(e, httpx.ConnectError):+ response = httpx.get(url)if response.status_code == 404:return None- if not response.ok:+ if not response.is_success:raise ValueError(f"HTTP {response.status_code} trying to load well-known OAuth metadata")return OAuthMetadata.model_validate(response.json())raise@@ -206,8 +206,8 @@ def exchange_authorization(if client_information.client_secret:params["client_secret"] = client_information.client_secret- response = requests.post(token_url, data=params)- if not response.ok:+ response = httpx.post(token_url, data=params)+ if not response.is_success:raise ValueError(f"Token exchange failed: HTTP {response.status_code}")return OAuthTokens.model_validate(response.json())@@ -237,8 +237,8 @@ def refresh_authorization(if client_information.client_secret:params["client_secret"] = client_information.client_secret- response = requests.post(token_url, data=params)- if not response.ok:+ response = httpx.post(token_url, data=params)+ if not response.is_success:raise ValueError(f"Token refresh failed: HTTP {response.status_code}")return OAuthTokens.model_validate(response.json())@@ -256,12 +256,12 @@ def register_client(else:registration_url = urljoin(server_url, "/register")- response = requests.post(+ response = httpx.post(registration_url,json=client_metadata.model_dump(),headers={"Content-Type": "application/json"},)- if not response.ok:+ if not response.is_success:response.raise_for_status()return OAuthClientInformationFull.model_validate(response.json())@@ -283,7 +283,7 @@ def auth(raise ValueError("Existing OAuth client information is required when exchanging an authorization code")try:full_information = register_client(server_url, metadata, provider.client_metadata)- except requests.RequestException as e:+ except httpx.RequestError as e:raise ValueError(f"Could not register OAuth client: {e}")provider.save_client_information(full_information)client_information = full_information