Sign API requests with HMAC-SHA256
Create and verify a timestamped signature over the method, path and body so requests cannot be forged or replayed.
HTTP clients, webhooks, pagination and integration patterns.
Loading snippets…
11 snippets
Create and verify a timestamped signature over the method, path and body so requests cannot be forged or replayed.
Retry rate-limited requests after the delay the server asks for, instead of guessing.
Return consistent, machine-readable API errors using the application/problem+json format.
Extract next, prev, first and last page URLs from an RFC 8288 Link header like GitHub's API returns.
Make POST requests safe to retry by sending a unique Idempotency-Key that the server can de-duplicate.
A small GET helper using urllib with a timeout, status check, size limit and JSON decoding errors.
Turn a sort position into a URL-safe cursor string and validate it when it comes back from the client.
Compute a strong ETag for a response body and answer If-None-Match with 304 Not Modified to save bandwidth.
Validate an HMAC-SHA256 webhook against the raw request body with a constant-time comparison and replay window.
Iterate cursor-paginated API results with for await, loading pages lazily and stopping early when needed.
Abort slow HTTP requests with AbortSignal.timeout and turn non-2xx responses into real errors.