The `polar-sdk` is the official Python client for the Polar API, designed to help developers integrate subscription and monetization features into their applications. It provides access to resources like products, subscriptions, and webhooks. As of version 0.31.3, it offers both synchronous and asynchronous interfaces and is actively maintained with frequent updates.
pip install polar-sdkVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `Polar` client, fetch a list of subscriptions, and handle potential API errors. It uses an asynchronous client, which is recommended for modern Python applications. Ensure you have `POLAR_API_KEY` set in your environment or replace the placeholder with your actual API key.
For async usage: `client = Polar(auth=..., is_async=True)` and call methods with `await`. For sync usage: `client = Polar(auth=...)` (default) and call methods directly without `await`.
Ensure `export POLAR_API_KEY='your_secret_key'` is set in your shell, or initialize with `client = Polar(auth='your_secret_key')`.
Wrap API calls in a `try...except PolarError as e:` block to handle API responses gracefully.
Upgrade to the latest version (`pip install --upgrade polar-sdk`) and refactor code according to the new client structure and import paths (e.g., `from polar import Polar`).
No dependency data recorded yet.