{"id":26916,"library":"dub","title":"Dub Python SDK","description":"Python client SDK for the Dub API (link management, analytics, etc.), generated by Speakeasy. Current version 0.35.7, requires Python >=3.10. Released frequently.","status":"active","version":"0.35.7","language":"python","source_language":"en","source_url":"https://github.com/dubinc/dub-python","tags":["sdk","api-client","links","analytics","speakeasy"],"install":[{"cmd":"pip install dub","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"HTTP client used internally","package":"httpx","optional":false},{"reason":"Data validation and serialization","package":"pydantic","optional":false}],"imports":[{"note":"Old import path was dub.client; current SDK exposes client at top level.","wrong":"from dub.client import Dub","symbol":"Dub","correct":"from dub import Dub"}],"quickstart":{"code":"from dub import Dub\n\nclient = Dub(\n    token=os.environ.get('DUB_API_KEY', ''),\n)\n\n# Create a short link\nlink = client.links.create(\n    url='https://example.com',\n    external_id='my-link',\n    tag_ids=[],\n)\nprint(link.id)","lang":"python","description":"Initialize with an API token and create a short link."},"warnings":[{"fix":"Use the top-level import: from dub import Dub","message":"Import path changed from 'from dub.client import Dub' to 'from dub import Dub' in v0.30+.","severity":"breaking","affected_versions":">=0.30.0"},{"fix":"Replace 'workspace_id' with 'project_slug' in SDK initialization.","message":"The 'workspace_id' parameter is deprecated; use 'project_slug' instead.","severity":"deprecated","affected_versions":"<0.36.0 (likely deprecated in 0.35.x)"},{"fix":"Wrap synchronous calls in asyncio.run(): asyncio.run(client.links.create(...))","message":"All SDK methods are async; run in async context or use asyncio.run().","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Upgrade to the latest version: pip install --upgrade dub","cause":"Outdated SDK version (<0.30.0) missing the top-level Dub class, or incorrect import.","error":"AttributeError: module 'dub' has no attribute 'Dub'"},{"fix":"Set DUB_API_KEY with a valid API token from the Dub dashboard.","cause":"Invalid or missing API key (DUB_API_KEY environment variable not set or incorrect).","error":"dub.core.ApiError: 401 Unauthorized"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}