
























We've implemented idempotency keys in our API! This means that you can now safely retry requests (intentionally or accidentally) without worrying about side effects, which is a thing that you probably care about a good deal if you're programmatically managing your newsletter subscribers/emails. To quote a somewhat recent Hacker News thread on the topic:
Having recently adopted Resend and skimmed a bunch of different email APIs, I'm still waiting to find a single provider whose API supports Stripe-style idempotency [1] so that I can guarantee I don't send the same email through their API multiple times. I'd like to confidently avoid accidentally spamming a user if i.e. a background job retries multiple times due to an unrelated error, or merely from failing to receive the API response that an email was sent/created successfully.
import requests
requests.post(
"https://api.buttondown.com/v1/emails",
json={"body": "It's great to see you again!", "subject": "Hello, world!"},
headers={"Idempotency-Key": "AaPYI03TpJgW7pgtPB09s"},
)
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。