Skip to content

Releases: 0cherednoq/eazy-sdk

Eazy SDK v0.2.0a16

Eazy SDK v0.2.0a16 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 12 Oct 19:41

Added:

  • QueryModel(target, using=None) in eazy_sdk.request and Http.get(..., query=...): the query of a request declared as one private model. Each field of the model is one query parameter, in the model's order, with a type; an operation field without a placement feeds the field of the same name; the rest take their defaults and stay out of the public signature. The model is built on every attempt, so a default_factory field is fresh on a retry. using= builds the model from the operation value and, with two parameters, from the requires= dependencies. It lives beside declared Query fields, Inject and session values; one name in two places is refused before the request.

Nothing existing changes: every declaration written for 0.2.0a15 keeps working.

Eazy SDK v0.2.0a15

Eazy SDK v0.2.0a15 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 12 Oct 16:55

Added:

  • Placed.body(name) and the chain Placed.body("token") | Placed.query("token") on a session field: a site that carries the session with the request's own parameters gets it in the form or JSON body of a write and in the query of a read. For each operation the first place it has is taken, left to right.

Fixed:

  • Literal[...] in the type of an input value was refused for every value, as the type of a field and as a field of a TypedDict value.
  • Following a redirect whose address repeats a query name ended in PlanError. Names inside an address may now repeat and go out as written; parameters an operation declares still have to be unique.
  • The request leaves with exactly the prepared query: the Zapros client kept one value per repeated name.

Nothing existing changes: every declaration written for 0.2.0a14 keeps working.

Also in the repository, not in the package: the skill eazy-sdk-from-capture, which writes an SDK from a recorded browser session and proves it by replaying the recording.

Eazy SDK v0.2.0a14

Eazy SDK v0.2.0a14 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 12 Oct 08:31

Changed (typing only, nothing changes at run time):

  • items() and first() on a paginated operation are typed by the element: what
    items= of the Pages strategy returns is what items() iterates and what
    first() returns (or None), and key= takes that element. Before, all three
    were Any. Checked under mypy and pyright.
  • NumberedPages, OffsetPages, CursorPages, NextUrlPages and Pagination take a
    second type parameter, the element; it defaults to Any.
  • HttpOperation no longer annotates pages: op() tells a paginated operation
    by the attribute being present.

Eazy SDK v0.2.0a13

Eazy SDK v0.2.0a13 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 11 Oct 16:26

Two conveniences for a paginated operation. Nothing existing changes: every declaration written for 0.2.0a12 keeps working.

Added: items(..., max_items=N), sync and async. The iteration ends after N elements, counted after key=, and no page past the one that gave the last of them is requested.

Added: first(...) on a paginated operation, sync and async. The first element, or None when the first page has none; always one request.

Eazy SDK v0.2.0a12

Eazy SDK v0.2.0a12 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 10 Oct 21:50

Eight declarative gaps found while building a real SDK are closed. Nothing existing changes: every declaration written for 0.2.0a11 keeps working.

Added: OneOf(...) and Not(...) in eazy_sdk.response, tags beside Const. OneOf(401, 403) reads "the field is one of these"; Not(200) reads "anything but this"; Not(200, 401, 403) leaves room for the cases that claim the listed values, so they never compete for one response.

Added: Payload[T] in a generic pydantic model. success={200: Ok[Account]} returns Account; a generic envelope used without a parameter is a declaration error.

Added: reauth. class TokenRejected(ApiError[Model]) with reauth = True, or Error(..., reauth=True), marks an error that means a stale session. The session is refreshed and the request replayed on the budget and under the idempotency rule of an HTTP 401; the error is raised when there is nothing left to refresh with.

Added: A | B on field sources (FirstOf). Annotated[str, Regex(...) | FromCookie("act")] fills one field from the first source that has the value, across document selectors, FromHeader, FromCookie and Location.query.

Added: eazy_sdk.dependencies.service_url(Router, path), the address a router is bound to in the SDK root, as a source for Inject and dependency(provide=...).

Added: markers.Url(hosts=...) and the short Url[str]. Http.get(markers.Url(hosts=("*.example",))) with a field url: Url[str] sends the request to an address the caller gives; a link to a host not listed is refused before the request is prepared.

Added: eazy_sdk.auth.ensure_session(sdk) and current_session(sdk), and eazy_sdk.cookies.cookies_of(sdk): the session and the user's cookies read from the SDK root or a router.

Added: eazy_sdk_browser.Failure(reads=PageMap). The exception factory of a page failure receives a built page map and may be a plain function.

Not supported: generic dataclass and msgspec envelopes; ensure_session and current_session on a synchronous SDK.

Eazy SDK v0.2.0a11

Eazy SDK v0.2.0a11 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 09 Oct 22:29

A session's cookies now travel like in a browser. This release is breaking: every other way to send a cookie the server set is removed.

Added: Cookies(required=(), leeway=..., public_suffixes=None) in eazy_sdk.auth, declared on an SDK root or a router. Every cookie the site sets goes back where it belongs: to the next operation, to the next hop of a redirect, to another host of the same site. Nobody names them; required lists the cookies without which a session is not valid.

Added: eazy_sdk.cookies with StoredCookie, CookieState and CookieJar, following RFC 6265. One jar per Identity: two identities over one client share no cookie, one identity over two clients shares all of them. Identity(cookies=CookieState(...)) starts from a saved set.

Added: the cookie snapshot is saved with the session under one revision and read back even when the saved session is no longer valid. The library never clears a user's cookies by itself, so a site recognizes the device at the next login.

Added: Resilience(max_redirects=N, client_redirects=True) follows a redirect written into a page with , on the same budget as a 3xx. Http.get(..., cookies=False) keeps one operation out of the jar.

Removed: session_cookie, eazy_sdk.auth.cookies (HttpCookieSession, parse_session_cookie), Placed.cookie, Placed.cookies, eazy_sdk_browser.BrowserCookie, browser_cookie_auth, BrowserCookieBridge, CookieAuthAdopter. Declare Cookies(...) instead; hand a browser session to an HTTP SDK with Identity(cookies=CookieState(state.cookies)).

Changed: SessionStore.save takes an optional cookies argument and StoredSession carries it. A store for a token session keeps working. eazy_sdk_sqlmodel needs one statement on an existing database: ALTER TABLE sessions ADD COLUMN cookie_state JSON.

Changed: StoredCookie.domain has no leading dot; host_only=False sends a cookie to subdomains. A browser session saved by an earlier version is not read and the owner signs in again.

Changed: session_scheme(Model) accepts a model that places nothing, the session of a site that keeps everything in cookies. Without Cookies(...) the first protected call raises SessionConfigurationError.

Without Cookies(...) nothing changes: a request is still fully determined by its operation.

pip install --pre "eazy-sdk-core[httpx,pydantic,html]==0.2.0a11"

Eazy SDK v0.2.0a10

Eazy SDK v0.2.0a10 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 09 Oct 18:13

An operation can read the outcome of a call from where its redirect points, one session can be placed into several parts of the request, and a document model can read text that no markup addresses.

Added: Location in eazy_sdk.response compares the redirect target part by part (host, path, query, contains; every part optional). On a model field it is the criterion of the case and the source of the field at once; Location.query("fail") reads one query parameter. The same object is a when= condition.

Added: HeaderModel. A model every field of which carries Location, FromHeader or FromCookie is read without the body. FromCookie("sid") reads a cookie the response sets.

Added: Placed.query, Placed.header, Placed.cookie and Placed.cookies in eazy_sdk.auth mark session model fields that go into every protected request, so session_scheme(Model).configure(...) gives the acquire and refresh lifecycle to a session that is more than one Bearer header.

Added: Regex in eazy_sdk_html, a third selector language beside CSS and XPath. It searches the document text as received; a single-value field takes the first match, a list field every match.

Changed: a redirect whose status an operation declares a case on is read by the operation. The client no longer follows it and no longer raises RedirectLimitError for it. An operation with no case on a redirect status behaves as before.

Changed: a case on a 3xx status must state a criterion (Location on a model field, when=, accept= or a Const tag); when=Location() means any target.

Changed: a session with an empty placed value is not valid and is acquired again. The slot of an auth placement now takes secret from AuthPlacement.secret.

pip install --pre "eazy-sdk-core[httpx,pydantic,html]==0.2.0a10"

Eazy SDK v0.2.0a9

Eazy SDK v0.2.0a9 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 07 Oct 10:03

A fix-only release.

Fixed: Inject values no longer land in another Inject's slot. Every attempt created a fresh dependency descriptor per Inject and registered its provider in the identity's DependencyRegistry under id(descriptor); once the descriptor was freed, the next one reused the address and received the stale provider, so a request silently carried a value of another parameter, possibly from another operation. The registry and the per-call caches are now keyed by the descriptor itself, an Inject provider stays on its own requirement instead of entering the shared registry, and requires=/inject= are lowered once per call, so Inject(cache=DependencyCachePolicy.CALL) keeps its value across retries.

No public API changes.

pip install --pre "eazy-sdk-core[httpx,pydantic]==0.2.0a9"

Eazy SDK v0.2.0a8

Eazy SDK v0.2.0a8 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 07 Oct 06:02

First release on PyPI, as one distribution: eazy-sdk-core.

Breaking: the core and every integration now ship in a single distribution. The separate eazy-sdk-html, eazy-sdk-accounts, eazy-sdk-sqlmodel, eazy-sdk-browser, eazy-sdk-openapi, eazy-sdk-asyncapi, eazy-sdk-presets, eazy-sdk-xml and eazy-sdk-adaptix distributions are gone, and the core is named eazy-sdk-core because PyPI rejects eazy-sdk as too similar to the unrelated eazysdk project. An extra installs only the third-party libraries an integration needs:

pip install --pre "eazy-sdk-core[httpx,pydantic]"
pip install --pre "eazy-sdk-core[openapi,yaml]"
pip install --pre "eazy-sdk-core[browser,playwright]"

Import packages (eazy_sdk, eazy_sdk_html, eazy_sdk_browser, ...), the eazy-sdk-openapi, eazy-sdk-asyncapi and eazy-sdk-sqlmodel-migrate commands and the x-eazy-sdk specification extension keep their names.

Breaking: response-case arbitration ranks a criterion above status precision, so a conditional service-level error is no longer shadowed by an operation's plain success status.

Added: when= on every response representation; Const and Payload in eazy_sdk.response for response facts; accept= on Json, Html, Extracted and Parsed; composable predicates in eazy_sdk.response.match; a native PydollDriver for pydoll-python 3 in eazy_sdk_browser.

Fixed: fallback= now answers a response that every declared case declined after parsing.

Documentation is rebuilt around one mail SDK tutorial shown for HTTP and browser and is published at https://0cherednoq.github.io/eazy-sdk/. The full list of changes is in CHANGELOG.md.

Eazy SDK v0.2.0a7

Eazy SDK v0.2.0a7 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 08 Sep 16:13

Declarative pagination (phase 52). An operation class declares how it pages next to http:

__pages__ = Pages.numbered(Model, page="page", size="per_page", items=lambda r: r.items, total_pages=lambda r: r.pages_count)

and the bound operation gains pages(...) and items(..., key=...) on both routers, with max_pages= and options=. Four strategies from eazy_sdk.pagination: Pages.numbered, Pages.offset, Pages.cursor, Pages.next_url. Every page is an ordinary send(); op() checks field names and the result type at import; the root export list is unchanged. No breaking change.