openemail.dns_connections
Chaque méthode de cet espace de noms : sa signature, ses paramètres, ce qu'elle retourne et un exemple.
Méthodes
The DNS provider accounts connected to the workspace, through which OpenEmail writes the records of a domain itself: list them, read what disconnecting one would leave behind, and disconnect it. Connecting one is done in the app, because the provider asks the person to sign in.
dns_connections.list()
List the DNS provider accounts connected to the workspace
def list( *, api_key: str | None = None, timeout: float | None = None,) -> DnsConnectionListResourceReturns every DNS provider account connected to the workspace, through which OpenEmail writes the records of a domain itself, as the Providers tab of the domains page in the app shows them. Each one names the domains it serves, how many records OpenEmail wrote through it and still keeps, and whether it is active, needs connecting again (needs-reauth) or was disconnected (revoked).
configured is False when this server cannot connect a provider at all. A connection is made in the app, because the provider asks the person to sign in, so there is no method to create one.
Paramètres
api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Retourne
DnsConnectionListResource, a dict with configured and every connection in data, disconnected ones included.
Exemple
from openemail import openemail connections = openemail.dns_connections.list() if not connections['configured']: print('This server cannot connect a DNS provider') for connection in connections['data']: print(connection['subject'], connection['status'], len(connection['domains']), 'domains')Remarques
A GET is retried automatically on network failure, on 408 and 5xx responses, and on a 429 that carries
Retry-After, up to the client'smax_retries.
Aussi disponible dans
dns_connections.get()
Read a DNS connection and what disconnecting it would leave behind
def get( id: str, *, api_key: str | None = None, timeout: float | None = None,) -> DnsConnectionDetailResourceReturns one connection with what disconnecting it would do: the domains it serves, the records OpenEmail wrote through it, busy for the domains a sync is running on right now, which hold a disconnect back until it ends, and keepsMail for the verified domains that stop receiving mail once their records come down.
Paramètres
idstrObligatoireA connection id from
list.api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Retourne
DnsConnectionDetailResource, the connection with its domains, records, busy and keepsMail.
Exemple
from openemail import openemail connection = openemail.dns_connections.get('dnsl_3f9a1c2e7b4d4e6f8a0b2c3d') if connection['busy']: print('A sync is running on', ', '.join(connection['busy'])) if connection['keepsMail']: print('These stop receiving mail:', ', '.join(connection['keepsMail']))Remarques
A connection id that is not in this workspace is a 404
resource_not_found.A GET is retried automatically on network failure, on 408 and 5xx responses, and on a 429 that carries
Retry-After, up to the client'smax_retries.
Aussi disponible dans
dns_connections.delete()
Disconnect a DNS provider account
def delete( id: str, *, api_key: str | None = None, timeout: float | None = None,) -> DeletedDnsConnectionResourceDisconnects the account as Disconnect does in the app: the records OpenEmail wrote through it come down, every domain it serves is detached, and the connection is revoked at the provider. A verified domain whose records come down stops receiving mail, so read get first. detached counts what came down and lists the records still published, to delete by hand.
A connection that is already disconnected is removed from the list instead, once no domain and no record is left on it, and removed says so.
Paramètres
idstrObligatoireA connection id from
list.api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Retourne
DeletedDnsConnectionResource with removed, confirmed and detached.
Exemple
from openemail import openemail result = openemail.dns_connections.delete('dnsl_3f9a1c2e7b4d4e6f8a0b2c3d')detached = result['detached'] if result['removed']: print('Removed from the list')elif detached is not None: print(detached['detached'], 'domains detached') for record in detached['left']: print('Delete by hand:', record['type'], record['name'], record['content'])Remarques
A sync running on one of its domains is refused with 409
dns_busy, and nothing is revoked. A disconnected connection that still has domains or records on it is refused with 409dns_connection_in_use.A key or an access token limited to particular addresses or domains is refused with 422
capability_unsupported. An access token acting for a member also needsworkspace:managein their role, or it is refused with 403insufficient_authority.An OAuth access token needs a verification code for this call, and is refused with 403
step_up_requireduntil the app has verified one in the last 60 minutes.is_step_up_requiredon the error says so. An API key is never asked for a code.Not retried by the SDK.