📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials API Design SDK Design

SDK Design

5 min read
Build SDK clients that hide HTTP complexity — typed methods, auto-auth headers, and raise_for_status.

Client SDK Design

class EzyCodersClient:
    def __init__(self, api_key: str):
        self.session = httpx.Client(
            base_url="https://api.ezycoders.com",
            headers={"Authorization":"Bearer "+api_key,
                     "Content-Type":"application/json"},
            timeout=30.0
        )

    def list_posts(self, page=1, limit=20):
        r = self.session.get("/v1/posts",params={"page":page,"limit":limit})
        r.raise_for_status()
        return r.json()

    def create_post(self, title, body, tags=None):
        r = self.session.post("/v1/posts",
            json={"title":title,"body":body,"tags":tags or []})
        r.raise_for_status()
        return r.json()

client = EzyCodersClient("sk-live-abc123")
posts  = client.list_posts(page=1, limit=10)