{"id":49139723,"url":"https://github.com/alby-sh/alby-sdk-python","last_synced_at":"2026-04-26T04:00:46.642Z","repository":{"id":352603366,"uuid":"1215497628","full_name":"alby-sh/alby-sdk-python","owner":"alby-sh","description":"Official Alby error-tracking SDK for Python 3.8+ (Django, Flask, FastAPI)","archived":false,"fork":false,"pushed_at":"2026-04-20T10:45:19.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-25T03:38:36.890Z","etag":null,"topics":["alby","django","error-monitoring","error-tracking","fastapi","flask","observability","python","sdk"],"latest_commit_sha":null,"homepage":"https://alby.sh","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alby-sh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-20T01:19:29.000Z","updated_at":"2026-04-20T09:52:48.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/alby-sh/alby-sdk-python","commit_stats":null,"previous_names":["alby-sh/alby-sdk-python"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/alby-sh/alby-sdk-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alby-sh%2Falby-sdk-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alby-sh%2Falby-sdk-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alby-sh%2Falby-sdk-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alby-sh%2Falby-sdk-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alby-sh","download_url":"https://codeload.github.com/alby-sh/alby-sdk-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alby-sh%2Falby-sdk-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32285283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T18:29:39.964Z","status":"online","status_checked_at":"2026-04-26T02:00:05.962Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alby","django","error-monitoring","error-tracking","fastapi","flask","observability","python","sdk"],"created_at":"2026-04-22T00:03:39.726Z","updated_at":"2026-04-26T04:00:46.616Z","avatar_url":"https://github.com/alby-sh.png","language":"Python","readme":"# alby-report\n\n[![PyPI version](https://img.shields.io/pypi/v/alby-report.svg?color=3776ab\u0026logo=pypi\u0026logoColor=white)](https://pypi.org/project/alby-report/)\n[![PyPI downloads](https://img.shields.io/pypi/dm/alby-report.svg?color=3776ab)](https://pypi.org/project/alby-report/)\n[![Python versions](https://img.shields.io/pypi/pyversions/alby-report.svg?color=3776ab\u0026logo=python\u0026logoColor=white)](https://pypi.org/project/alby-report/)\n[![CI](https://github.com/alby-sh/alby-sdk-python/actions/workflows/ci.yml/badge.svg)](https://github.com/alby-sh/alby-sdk-python/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n\nOfficial [Alby](https://alby.sh) error-tracking SDK for Python.\n\nCaptures uncaught exceptions and anything you explicitly report, then ships them to your Alby project where an AI agent can auto-open a fix task.\n\nZero runtime dependencies. Python 3.8+.\n\n## Install\n\n```bash\npip install alby-report\n```\n\n## Use\n\n```python\nimport os\nimport alby\n\nalby.init(\n    dsn=os.environ['ALBY_DSN'],    # https://\u003ckey\u003e@alby.sh/ingest/v1/\u003capp-id\u003e\n    release='1.4.2',\n    environment='production',\n)\n\n# Uncaught exceptions are sent automatically (sys.excepthook + threading.excepthook).\n\n# Manual report:\ntry:\n    do_thing()\nexcept Exception as exc:\n    alby.capture_exception(exc)\n\n# Non-error events:\nalby.capture_message('Failed to acquire lease', level='warning')\n\n# Enrich:\nalby.set_user({'id': 'u_412', 'email': 'ada@example.com'})\nalby.set_tag('region', 'eu-west-3')\nalby.set_context('billing_tenant', {'plan': 'pro', 'seats': 12})\nalby.add_breadcrumb({'type': 'http', 'message': 'GET /api/orders/42'})\n\n# Decorator:\n@alby.monitor\ndef charge_customer(customer_id: str) -\u003e None:\n    ...\n\n# Before exit (e.g. in a short-lived CLI):\nalby.flush(2000)\n```\n\n## Options\n\n| Option            | Type           | Default         | Notes |\n|-------------------|----------------|-----------------|-------|\n| `dsn`             | `str`          | - (required)    | The DSN from your Alby app settings. |\n| `release`         | `str`          | `''`            | Your build version. Enables release tracking / auto-resolve. |\n| `environment`     | `str`          | `$ALBY_ENV` or `'production'` | `production` / `staging` / `dev` / anything. |\n| `sample_rate`     | `float`        | `1.0`           | Fraction of events actually sent. |\n| `platform`        | `str`          | `'python'`      | Override auto-detection. |\n| `server_name`     | `str`          | `socket.gethostname()` | Attached to every event. |\n| `auto_register`   | `bool`         | `True`          | Install `sys.excepthook` + `threading.excepthook` handlers. |\n| `transport`       | `Transport`    | `HttpTransport` | Custom delivery (tests, batching, filesystem spool). |\n| `debug`           | `bool`         | `False`         | Log SDK diagnostics to stderr. |\n| `max_breadcrumbs` | `int`          | `100`           | Ring buffer size. |\n\n## Framework integrations\n\n### Django\n\nIn `settings.py`:\n\n```python\nMIDDLEWARE = [\n    # ... Django's own middleware ...\n    'alby.integrations.django.AlbyMiddleware',\n]\n```\n\nInitialise Alby early in your app setup (e.g. `settings.py` or `wsgi.py`).\n\n### Flask\n\n```python\nfrom flask import Flask\nfrom alby.integrations.flask import init_app as alby_init_app\n\napp = Flask(__name__)\nalby_init_app(app)\n```\n\n### FastAPI / Starlette\n\n```python\nfrom fastapi import FastAPI\nfrom alby.integrations.fastapi import AlbyMiddleware\n\napp = FastAPI()\napp.add_middleware(AlbyMiddleware)\n```\n\n## Transport\n\n* `urllib.request` under the hood (zero deps).\n* Non-blocking: a bounded `queue.Queue(maxsize=100)` plus a daemon worker thread. `capture_*` only enqueues.\n* Retries: 3 attempts at 1s / 5s / 15s backoff.\n* Honours `Retry-After` on HTTP 429.\n* Best-effort drain on interpreter exit via `atexit`.\n\nFor synchronous delivery, inject your own `Transport` via `alby.init(transport=...)`.\n\n## Wire protocol\n\nThis SDK speaks the [Alby Ingest Protocol v1](./PROTOCOL_V1.md). If you're writing a new SDK (different runtime, different language) start there.\n\n## Links\n\n- Website: [alby.sh](https://alby.sh)\n- Report issues: [GitHub Issues](https://github.com/alby-sh/alby-sdk-python/issues)\n- Other SDKs: [alby-sdk-js](https://github.com/alby-sh/alby-sdk-js) · [alby-sdk-browser](https://github.com/alby-sh/alby-sdk-browser) · [alby-sdk-php](https://github.com/alby-sh/alby-sdk-php)\n\n## License\n\nMIT (c) Alby.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falby-sh%2Falby-sdk-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falby-sh%2Falby-sdk-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falby-sh%2Falby-sdk-python/lists"}