Skip to content

docs(examples): handle subscription_inactive in the error-handling example - #50

Merged
emirlan-zen merged 2 commits into
mainfrom
batch-example-inactive-subscription
Oct 15, 2026
Merged

emirlan-zen merged 2 commits into
mainfrom
batch-example-inactive-subscription

Conversation

@emirlan-zen

Copy link
Copy Markdown
Contributor

What changes

Adds a subscription_inactive case to examples/05_error_handling.py. The Batch API returns it with 401 when the API key is valid but the subscription is past due, unpaid, incomplete or paused. The message also mentions Azure Marketplace for subscriptions bought there. Without it, a reader copying the example would send this case to the "bad API key" branch.

The SDK itself needs no change. BatchAPIError.code already passes through any code the server sends.

Tests

  • ruff check and ruff format --check pass on the example.
  • Ran the example live against a local Batch API that returns the old response (unauthenticated) and the new one (subscription_inactive). Each prints the matching message.

🤖 Generated with Claude Code

@emirlan-zen
emirlan-zen marked this pull request as ready for review October 15, 2026 12:33
…ample

The Batch API answers a valid key whose subscription is past due, unpaid,
incomplete or paused with 401 code subscription_inactive. Show it next to
unauthenticated so readers don't treat it as a bad key.
@emirlan-zen
emirlan-zen force-pushed the batch-example-inactive-subscription branch from 348754c to 3dd6471 Compare October 15, 2026 12:34
@emirlan-zen
emirlan-zen requested a review from AnderRV October 15, 2026 12:36
@emirlan-zen
emirlan-zen merged commit c0d49ff into main Oct 15, 2026
2 checks passed
@emirlan-zen
emirlan-zen deleted the batch-example-inactive-subscription branch October 15, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants