openemail.sending
Bu ad alanındaki her yöntem: imzası, parametreleri, döndürdüğü değer ve bir örnek.
Yöntemler
How mail leaves the workspace: the two lanes it travels in, transactional for app mail and broadcast for newsletters, each with its bounce and complaint numbers, the switch that resumes a paused lane, and the dedicated IPs of a workspace that bought one.
sending.list_streams()
List the sending lanes
def list_streams( *, api_key: str | None = None, timeout: float | None = None,) -> SendingStreamListResourceReturns the two lanes mail travels in, transactional for app mail such as password resets, receipts and codes, and broadcast for newsletters, each with its state and its numbers for the last 7 days: recipients, bounced and complained, the two rates, and the limits the broadcast lane is held to. The lanes have their own queues and their own reputation, so a newsletter never holds up or harms app mail.
The broadcast lane pauses itself when more than 4% of its recipients bounced or more than 0.2% reported the mail as spam over those 7 days, once it reached enough recipients to judge. A paused lane says when and why in pausedAt and pausedReason, and app mail keeps going out. The count starts again when a lane is resumed, which resumedAt gives.
Parametreler
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.
Döndürür
SendingStreamListResource, a dict with one SendingStreamResource per lane in data: stream, status, pausedAt, pausedReason, resumedAt, window and limits.
Örnek
from openemail import openemail lanes = openemail.sending.list_streams() for lane in lanes['data']: print( lane['stream'], lane['status'], lane['window']['bounceRate'], lane['window']['complaintRate'], )Notlar
Only the broadcast lane pauses. The transactional lane is always
'active'.A GET is retried automatically on network failure and on 408, 500, 502, 503 and 504 responses, up to the client's
max_retries, and on a 429 only when it carries aRetry-Afterof a minute or less.
Şurada da var
sending.resume_stream()
Resume a paused lane
def resume_stream( stream: SendStream, *, api_key: str | None = None, timeout: float | None = None,) -> SendingStreamResourceResumes the broadcast lane after it was paused for too many bounces or complaints, as Resume does on the Analytics page of the app. Broadcasts and messages that were on hold continue at once, and the 7 day count starts again from now, so clean the audience first: a lane resumed onto the same list pauses again.
Only the workspace owner may do it: an API key acts for the owner, and an access token that acts for a member is 403 owner_only.
Parametreler
streamSendStreamZorunluThe lane to resume,
'broadcast'. The transactional lane never pauses.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.
Döndürür
SendingStreamResource, now with status 'active' and resumedAt set.
Örnek
from openemail import openemail lane = openemail.sending.resume_stream('broadcast') print(lane['status'], lane['resumedAt'])Notlar
With an OAuth access token it asks for a verification code: until the app has verified one, it raises
OpenEmailApiErrorwith status 403, codestep_up_requiredandis_step_up_requiredset. An API key is never asked.A lane that is not paused is 409
stream_not_paused.The SDK does not retry it.
Şurada da var
sending.list_dedicated_ips()
List dedicated IPs
def list_dedicated_ips( *, api_key: str | None = None, timeout: float | None = None,) -> DedicatedIpListResourceReturns the dedicated sending IPs of the workspace, bought as an add-on with billing.start_add_on_checkout. A new IP is warmed up over several weeks: warmupPercent says how far it is, and until it reaches 100 part of the mail still leaves through the shared IPs, so nothing is held back while it warms. status is 'warming' until then and 'ready' after.
A workspace without the add-on gets an empty data list and sends through the shared IPs.
Parametreler
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.
Döndürür
DedicatedIpListResource, a dict with one DedicatedIpResource per IP in data: ip, status, pool, poolStatus, warmupPercent, assignedAt, readyAt and checkedAt.
Örnek
from openemail import openemail addresses = openemail.sending.list_dedicated_ips() for address in addresses['data']: print(address['ip'], address['status'], f'{address["warmupPercent"]}%')Notlar
The warm-up is read from the sending service every few minutes, and
checkedAtsays when.A GET is retried automatically on network failure and on 408, 500, 502, 503 and 504 responses, up to the client's
max_retries, and on a 429 only when it carries aRetry-Afterof a minute or less.
Şurada da var
sending.get_dedicated_ip()
Read a dedicated IP
def get_dedicated_ip( ip: str, *, api_key: str | None = None, timeout: float | None = None,) -> DedicatedIpResourceReturns one dedicated IP of the workspace with its status and how far its warm-up has come.
Parametreler
ipstrZorunluThe IP address, as
list_dedicated_ipsreturns it, such as'203.0.113.24'.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.
Döndürür
DedicatedIpResource with ip, status, pool, poolStatus, warmupPercent, assignedAt, readyAt and checkedAt.
Örnek
from openemail import openemail address = openemail.sending.get_dedicated_ip('203.0.113.24') print(address['status'], address['warmupPercent'])Notlar
An IP that does not belong to the workspace is a 404
resource_not_found.A GET is retried automatically on network failure and on 408, 500, 502, 503 and 504 responses, up to the client's
max_retries, and on a 429 only when it carries aRetry-Afterof a minute or less.