Python
Changelog
Every release of the package, newest first.
0.0.1
The first release of the Python package. It has a method for every one of the 684 methods of the TypeScript SDK, in 53 namespaces, each under its TypeScript name in snake_case, and a parity check in the package’s own build proves that every one sends the same request as its TypeScript twin.
- Two clients with the same methods and arguments:
Nextmail, which blocks, andAsyncNextmail, which is awaited and runs on asyncio and on trio. Each has an attribute for every namespace, fromemails,threadsandtemplatestoautomations,bookingsandconnected_mailboxes. - A request body is a dict whose keys keep the API’s camelCase names, the options of a call are snake_case keyword arguments such as
idempotency_key=andlimit=, and a response comes back as a dict. Every body, result and webhook payload has aTypedDictinnextmail.types, so a type checker catches a misspelt key. - A client takes an API key or an OAuth access token, or reads
NEXTMAIL_API_KEY,NEXTMAIL_ACCESS_TOKENandNEXTMAIL_BASE_URL.access_token=also takes a function that returns the token, called before every request, which may be async onAsyncNextmail.base_url,timeout,max_retries,headers,user_agentandhttp_client, your ownhttpxclient, set the rest. Every method also takestimeout=for one call, andapi_key=, orinbox_token=ontemp_mail, to act with another credential. from nextmail import nextmailis a ready-made client, built from the environment the first time it is touched, andinit(...)configures it once at startup.create_temp_mail()andcreate_async_temp_mail()open disposable inboxes with no credential.- Every paginated resource has
listfor one page,list_allfor every item as a list, anditerate, which yields each item and fetches the next page only when it gets there. - An API refusal raises
NextmailApiError, withstatus,type,code,param,doc_url,request_id,retry_after_secondsandfields, and checks such asis_validation,is_not_found,is_rate_limited,is_step_up_requiredandis_retryable. No response at all raisesNextmailNetworkError, withis_timeoutwhen the deadline passed. Both derive fromNextmailError, and a mistake in the call itself raisesValueErrorbefore anything is sent. - Reads, sends and every write that is safe to repeat are retried on 408, 500, 502, 503 and 504 with backoff, and on a 429 only when its
Retry-Afteris a minute or less. A send carries an idempotency key that its retries reuse, so a retry never sends a second message.timeoutbounds a whole attempt, the response body included, and uploads wait at least ten minutes. verify_webhook_signaturechecks a delivery in constant time, refuses one more than five minutes old and returns the parsed event, or raisesWebhookVerificationError.- The helpers of the TypeScript SDK are here too, such as
to_base64andresolve_language, and every value set it exports is a constant innextmail.constants, such asWEBHOOK_EVENTSandAPI_SCOPES. client.raw.request()reaches any endpoint with the client’s credential, base URL, timeout and retries, and a credential is never sent over plain HTTP, except to a server on this machine.- When a newer version is on PyPI, the client says so once, on a terminal only.
disable_update_notice=TrueorNEXTMAIL_DISABLE_UPDATE_NOTICE=1turns that off. - It needs Python 3.10 or newer and depends only on
httpx,anyioandtyping-extensions.
Google Workspace