diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a7715ac..89e56b0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx&utm_medium=paddle-python-sdk) for information about changes to the Paddle Billing platform, the Paddle API, and other developer tools. -## Unreleased +## 1.19.0 - 2026-11-24 ### Added @@ -19,26 +19,21 @@ Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx - `Client.api_keys.get_rotation_for_current_key` - Added `api_key.read` to `ApiKeyPermission` - Added `api_key_rotation.created` and `api_key_rotation.updated` events, including simulation payload support -- Added a `py.typed` marker so type checkers such as mypy and pyright use the SDK's type annotations +- Added a `py.typed` marker, so mypy and pyright check your code against the SDK's type annotations - Added `BodyRequest`, `ContentRequest` and `DataRequest` protocols to `paddle_billing.Notifications.Requests`, for typing your own webhook request objects ### Changed -- If you run mypy over code that uses the SDK, upgrading may report new errors. Before this release mypy treated the SDK as untyped, so values from it were `Any`. It now checks them against the SDK's annotations, for example `client.customers.response` is `Response | None` and API fields that can be `null` are typed as optional. `CreateReport` is now generic, so under `mypy --strict` a bare `CreateReport` annotation reports missing type arguments; use `CreateReport[Any, Any]` or a specific report operation such as `CreateTransactionsReport`. Pyright already read the SDK's annotations -- Package `__init__` modules now re-export their names explicitly, so imports such as `from paddle_billing import Client` pass pyright and `mypy --strict` -- `Verifier.verify()` and `NotificationEvent.from_request()` take `Request | BodyRequest | ContentRequest | DataRequest`, so framework request objects such as Django's and Flask's pass type checkers. The `Request` protocol is unchanged -- `Verifier.verify()` is typed as returning `bool` -- Corrected type annotations that type checkers will now see, including: - - The `response` attribute on resource clients (for example `client.customers.response`) is typed as `Response | None` - - `CreateReport` is generic over its report type and filters, and `get_allowed_filters()` returns filter classes - - `Paginator.next_page()` returns `Collection[Any]` and `ReportsClient.create()` takes `CreateReport[Any, Any]` - - `Collection.key()` returns `str | int`, since it falls back to the item's position when there's no `id` - - Operation fields that default to `Undefined()` (for example on `CreateAddress`) include `Undefined` in their type - - `Client.transaction_id` accepts a `UUID` +- `UpdateCheckoutUrl` now requires `default_url` as a non-null `str`. The API no longer accepts `None` or a missing `default_url` when updating the checkout URL, so a default checkout URL can be changed but not cleared +- `Verifier.verify()` logs expected rejections at `WARNING` instead of `CRITICAL`: a missing `Paddle-Signature` header, or a timestamp outside the allowed variance or in the future. If you alert on `CRITICAL` records from the `paddle_billing` logger, update the alert +- mypy now checks code that uses the SDK against its annotations, where before it treated the SDK as untyped, so upgrading may report new errors. For example, `client.customers.response` is `Response | None`, and fields the API can return as `null` include `None` in their type, such as `PaymentMethod.card: Card | None`. Under `mypy --strict`, a bare `CreateReport` annotation needs type arguments, such as `CreateReport[Any, Any]`. Pyright already read the SDK's annotations +- `Verifier.verify()` and `NotificationEvent.from_request()` take `Request | BodyRequest | ContentRequest | DataRequest`, so Django, Flask, httpx and requests request objects pass type checkers ### Fixed -- `GET` requests that exhaust their retries on a retryable status (429, 5xx) now raise the corresponding `ApiError` (including `retry_after`) instead of a generic `requests.exceptions.RetryError` +- Cloudflare 520–524 errors are now retried with backoff for idempotent methods such as `GET`, like other transient errors +- `DateTime` now converts timezone-aware values to UTC instead of dropping their offset. For example, `12:00:00+02:00` was previously sent as `12:00:00Z`, two hours late. Naive values are still treated as UTC +- `GET` and `DELETE` requests that exhaust their retries on a 429 or 5xx now raise the error from the last response instead of `requests.exceptions.RetryError`: `ApiError` (with `retry_after` from any `Retry-After` header), or `requests.HTTPError` for a Cloudflare error page with no JSON body. If you catch `RetryError`, catch `ApiError` or `requests.RequestException` instead - `Verifier(maximum_variance=None)` no longer raises a `TypeError` on `verify()`. `None` skips the time drift check, like `0` - `Verifier.verify()` and `NotificationEvent.from_request()` skip a `body`, `content` or `data` attribute that is `None` and read the next one, instead of raising `AttributeError` - `NotificationPayout.from_dict()` no longer raises `TypeError: 'module' object is not callable` diff --git a/paddle_billing/Client.py b/paddle_billing/Client.py index e65bc0a1..2b5818bd 100644 --- a/paddle_billing/Client.py +++ b/paddle_billing/Client.py @@ -247,7 +247,7 @@ def build_request_session(self) -> Session: "Authorization": f"Bearer {self.__api_key}", "Content-Type": "application/json", "Paddle-Version": str(self.use_api_version), - "User-Agent": "PaddleSDK/python 1.18.0", + "User-Agent": "PaddleSDK/python 1.19.0", } ) diff --git a/setup.py b/setup.py index 20bc18cb..790e3ae4 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup( - version="1.18.0", + version="1.19.0", author="Paddle and contributors", author_email="team-dx@paddle.com", description="Paddle's Python SDK for Paddle Billing",