Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.3.0] - 2026-10-01

### Added

- `unwrap(response, unexpected_status_type=...)`: another generated client passes its own
`UnexpectedStatus`, so that `unwrap()` raises the same exception as its generated functions
instead of the `UnexpectedStatus` of `shellrent_sdk.client`, which its callers would not catch.
Without it, `unwrap()` raises the `UnexpectedStatus` of `shellrent_sdk.client` as before.
- `ServiceServerPaginatedListResponse`, from the updated specification.

### Changed

- `FileTokenStore()` without a directory follows `SHELLRENT_TOKEN_CACHE`, like the `shellrent`
command: a directory, or `off` to keep the tokens in memory without writing any file. A directory
passed to `FileTokenStore` still wins. The command now uses `FileTokenStore()` itself, with the
same behaviour as before.
- Functions and models regenerated from the updated specification of the Shellrent API:
- the default of `per_page` in the list operations is 15 instead of 20, as in the API;
- `list_active_monitoring_products` and `list_private_cloud_sv_products` return
`ServicePaginatedListResponse`, `list_cloud_vps_products` and `list_dedicated_server_products`
return `ServiceServerPaginatedListResponse`: their `meta` is a `PaginationMeta`.

### Removed

- `ServiceListResponse`, `ServiceListResponseMetaType0`, `ServiceServerListResponse` and
`ServiceServerListResponseMetaType0`, no longer in the specification: use
`ServicePaginatedListResponse` and `ServiceServerPaginatedListResponse`.

## [0.2.0] - 2026-10-01

### Added
Expand Down Expand Up @@ -45,6 +73,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`invalid_client` or, for its rate limit, `rate_limited`.
- The `shellrent` command, with `shellrent api` and `shellrent token`.

[Unreleased]: https://github.com/shellrent/shellrent-sdk-python/compare/v0.2.0...HEAD
[Unreleased]: https://github.com/shellrent/shellrent-sdk-python/compare/v0.3.0...HEAD
[0.3.0]: https://github.com/shellrent/shellrent-sdk-python/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/shellrent/shellrent-sdk-python/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/shellrent/shellrent-sdk-python/releases/tag/v0.1.0
10 changes: 6 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ da `spec/openapi.yaml`; a mano solo autenticazione, creazione del client, CLI, t
- `auth.py`, `http.py` e `cli.py` non importano nulla da `shellrent_sdk.client` (lo verifica `test_layers.py`).
- I transport di default di `RetryTransport` seguono l'ambiente come quelli di httpx: proxy con
`urllib.request.getproxies`/`proxy_bypass` (httpx non ha un'API pubblica), certificati con `trust_env`.
- L'interfaccia pubblica di `auth`, `http`, di `unwrap()` e `ApiException` (con `ApiErrorLike`) e della CLI
(`main(argv)`, comandi, variabili d'ambiente, exit code) è usata da `shellrent-internal-sdk`: cambiarla è
una modifica incompatibile (major). Il client generato interno passa il proprio `ApiError` a
`unwrap(error_type=...)`: `ApiException` non dipende dall'`ApiError` di questo pacchetto.
- L'interfaccia pubblica di `auth`, `http`, di `unwrap()` (con `error_type` e `unexpected_status_type`) e
`ApiException` (con `ApiErrorLike`) e della CLI (`main(argv)`, comandi, variabili d'ambiente, exit code) è
usata da `shellrent-internal-sdk`: cambiarla è una modifica incompatibile (major). Il client generato
interno passa il proprio `ApiError` e la propria `UnexpectedStatus` a
`unwrap(error_type=..., unexpected_status_type=...)`: `ApiException` non dipende dall'`ApiError` di questo
pacchetto e chi usa il client interno riceve la sua `UnexpectedStatus`.
- `create_client()` restituisce `AuthenticatedClient` perché le funzioni generate lo richiedono nel tipo; il
token lo mette `OAuth2Auth` a ogni richiesta, non il campo `token` del client.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,18 @@ this saves a token request per process and keeps you within the limit of the tok
```python
from shellrent_sdk import FileTokenStore, create_client

# $XDG_CACHE_HOME/shellrent-sdk, or ~/.cache/shellrent-sdk
# $SHELLRENT_TOKEN_CACHE, or $XDG_CACHE_HOME/shellrent-sdk, or ~/.cache/shellrent-sdk
client = create_client(token_store=FileTokenStore())

# In a web application the home directory of the server user may not be writable:
client = create_client(token_store=FileTokenStore("/var/cache/myapp/shellrent"))
```

Without a directory, `FileTokenStore()` follows `SHELLRENT_TOKEN_CACHE`, like the
[`shellrent` command](#command-line): the variable sets another directory, or `off` keeps the tokens
in memory, for the life of the process, without writing any file. A directory passed to
`FileTokenStore` wins over the variable.

`FileTokenStore` creates its directory readable by its owner only (0700) and writes each token
atomically to a file with mode 0600. The client secret is never cached.

Expand Down Expand Up @@ -258,8 +263,8 @@ fi

Each run is a new process, so the command keeps the token in a file, in `$XDG_CACHE_HOME/shellrent-sdk`
or `~/.cache/shellrent-sdk`, and reuses it until it expires: scripts run by cron do not request a
token every time. `SHELLRENT_TOKEN_CACHE` sets another directory, or `off` to keep the token only
for the current run. `python -m shellrent_sdk` is the same as `shellrent`, and
token every time. `SHELLRENT_TOKEN_CACHE`, as for `FileTokenStore()`, sets another directory, or
`off` to keep the token only for the current run. `python -m shellrent_sdk` is the same as `shellrent`, and
`uvx --from shellrent-sdk shellrent` runs it without installing it.

## Using httpx directly
Expand Down
Loading
Loading