Rate limiting
You can make up to 6,000 calls every 300 seconds. Go over that and the call answers 429 Too Many Requests, after which every endpoint refuses your calls for the next 10 seconds.
Sending requests again
When a call answers 429 or 5xx, or gets no answer at all, retry it with a backoff, waiting longer before each attempt and stopping after a few. Correct any other 4xx before you send it again.
Creating a transfer is safe to retry because Notabene never creates two transfers with the same ref, and Errors shows what such a retry answers.
import requests
from urllib3.util.retry import Retry
retry_strategy = Retry(
total=3,
backoff_factor=1,
status_forcelist=[429, 500, 502, 503, 504],
allowed_methods=["POST", "GET", "PATCH", "PUT", "DELETE"],
)
session = requests.Session()
session.mount("https://", requests.adapters.HTTPAdapter(max_retries=retry_strategy))
async function call(url, options, attempts = 3) {
for (let attempt = 0; ; attempt++) {
const response = await fetch(url, options);
const retry = response.status === 429 || response.status >= 500;
if (!retry || attempt === attempts) return response;
await new Promise(wait => setTimeout(wait, 1000 * 2 ** attempt));
}
}
import requests
from urllib3.util.retry import Retry
retry_strategy = Retry(
total=3,
backoff_factor=1,
status_forcelist=[429, 500, 502, 503, 504],
allowed_methods=["POST", "GET", "PATCH", "PUT", "DELETE"],
)
session = requests.Session()
session.mount("https://", requests.adapters.HTTPAdapter(max_retries=retry_strategy))async function call(url, options, attempts = 3) {
for (let attempt = 0; ; attempt++) {
const response = await fetch(url, options);
const retry = response.status === 429 || response.status >= 500;
if (!retry || attempt === attempts) return response;
await new Promise(wait => setTimeout(wait, 1000 * 2 ** attempt));
}
}Updated about 6 hours ago
Did this page help you?
