PageSourceSearch

https://shiftnex.ai/assets/PythonSdkPage-DoMegrAA.js

js shiftnex.ai collected 2026-10-05 12:36:29 UTC 2,491 bytes, 1 lines download raw bytes

1import{r as n,j as e,J as i}from"./index-ByN0RtWI.js";import{A as h}from"./ApiGuideLayout-UzaYAgUZ.js";import{A as r}from"./ApiDarkCodeBlock-ByFZqxhP.js";import{R as p,g as u,l as y}from"./RegenerateSdkBar-vq2ZABpk.js";import"./v3-design-Usx7DSJe.js";function m(){const[s,l]=n.useState(null),[c,o]=n.useState(!1),a=async(d=!1)=>{o(!0);try{const t=await u("python");l(t),y({language:"python",specVersion:t.specVersion,resourceCount:1}),d||i.success(`Python examples regenerated from spec v${t.specVersion}`)}catch(t){i.error("Failed to regenerate",{description:t.message})}finally{o(!1)}};return n.useEffect(()=>{a(!0)},[]),e.jsxs(h,{eyebrow:"SDK · Python",title:"ShiftNex Python SDK",intro:"Sync + async client for Python 3.10+. Starter template — drop any block into your project.",visibility:"public",documentTitle:"Python SDK",children:[e.jsx(p,{language:"python",busy:c,onRegenerate:()=>a(!1),generatedAt:(s==null?void 0:s.generatedAt)??null,specVersion:(s==null?void 0:s.specVersion)??null}),e.jsx("h2",{children:"Install"}),e.jsx(r,{tabs:[{language:"bash",label:"shell",code:(s==null?void 0:s.install)??""}]}),e.jsx("h2",{children:"Authenticate"}),e.jsxs("p",{children:["Use ",e.jsx("code",{children:"sk_test_…"})," against the sandbox; switch to ",e.jsx("code",{children:"sk_live_…"})," when you're ready for production. Keep the key server-side."]}),e.jsx(r,{tabs:[{language:"python",label:"auth.py",code:(s==null?void 0:s.auth)??""}]}),e.jsx("h2",{children:"Pagination"}),e.jsxs("p",{children:["Cursor-based. Use ",e.jsx("code",{children:"iter()"})," when you want a generator that hides cursoring for you."]}),e.jsx(r,{tabs:[{language:"python",label:"paginate.py",code:(s==null?void 0:s.pagination)??""}]}),e.jsx("h2",{children:"Errors & retries"}),e.jsxs("p",{children:[e.jsx("code",{children:"ShiftNexError"})," carries a stable ",e.jsx("code",{children:"code"}),", a ",e.jsx("code",{children:"request_id"})," for support, and a ",e.jsx("code",{children:"retry_after_ms"})," for 429s. Send an ",e.jsx("code",{children:"idempotency_key"})," on all writes."]}),e.jsx(r,{tabs:[{language:"python",label:"errors.py",code:(s==null?void 0:s.errors)??""}]}),e.jsx("h2",{children:"Webhooks"}),e.jsxs("p",{children:["Verify with ",e.jsx("code",{children:"construct_event"}),". It computes HMAC-SHA256 over the raw body and rejects events older than 5 minutes."]}),e.jsx(r,{tabs:[{language:"python",label:"server.py",code:(s==null?void 0:s.webhooks)??""}]})]})}export{m as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.