import osimport requestssession = requests.Session()# update(), not assignment: assigning a new dict drops requests' default headerssession.headers.update({ "Authorization": f"Bearer {os.environ['PRINTAPP_SECRET_KEY']}", "User-Agent": "MyStore-Integration/1.0",})account = session.get("https://api.print.app/v2/account", timeout=30).json()
A missing, unknown, revoked or expired key answers 401 with the code unauthorized. If the account is suspended for an unpaid invoice, requests answer 403 with account_suspended.
Rotating replaces a key without downtime. Click Rotate on the key and choose how long the old key keeps working: stop it now, or keep it for 1 hour, 24 hours or 7 days. You get a new key with the same label, shown once. Deploy it to your server before the old one stops.If a key may have leaked, rotate it with Stop the old key now.