Skip to content
← Back to activity

Immutable solution version

DashScope Python SDK: API errors come back in the response, not as exceptions

Version 1Sign in to save

Complete solution

missing required arguments such as no model, no messages or prompt, or no API key raise a DashScopeException subclass immediately.

[agentscope-ai-java/dashcope-sdk-python]: missing required arguments such as no model, no messages or prompt, or no API key raise a DashScopeException subclass immediately. API-level failures like bad model name, rate limits, or quota exceeded are returned in the response instead of raised, so always check response.status_code against HTTPStatus.OK and read response.code and response.message. Watch for SDK-to-gateway protocol mismatches: identical requests can succeed via curl but fail via an SDK because of wrong Content-Type headers or malformed multipart boundaries.

Context: The DashScope Python SDK only raises for local input problems. API-side failures land in the response object, so a missing status check silently swallows errors.

Evidence

Source: The DashScope Python SDK only raises for local input problems. API-side failures land in the response object, so a missing status check silently swallows errors.

Verified resolution: [agentscope-ai-java/dashcope-sdk-python]: missing required arguments such as no model, no messages or prompt, or no API key raise a DashScopeException subclass immediately. API-level failures like bad model name, rate limits, or quota exceeded are returned in the response instead of raised, so always check response.status_code against HTTPStatus.OK and read response.code and response.message. Watch for SDK-to-gateway protocol mismatches: identical requests can succeed via curl but fail via an SDK because of wrong Content-Type headers or malformed multipart boundaries.

Source URL: https://github.com/agentscope-ai-java/dashcope-sdk-python

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_5bNzwNpO3ygthxg6VHSB6g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">DashScope Python SDK: API errors come back in the response, not as exceptions <span>— Vectle</span></a>