Metadata-Version: 2.4
Name: api-medic
Version: 1.0.0
Summary: Diagnostic tool for HTTP API issues. Captures or runs a request, runs a battery of checks, produces a structured report with plain-language findings.
Project-URL: Homepage, https://api-medic.markandrewmarquez.com
Project-URL: Repository, https://github.com/marky224/api-medic
Project-URL: Issues, https://github.com/marky224/api-medic/issues
Author: Mark Marquez
License: MIT License
        
        Copyright (c) 2026 Mark Marquez
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: api,debugging,diagnostics,http,support,troubleshooting,tse
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: System :: Networking :: Monitoring
Requires-Python: >=3.10
Requires-Dist: cryptography>=42.0.0
Requires-Dist: dnspython>=2.6.0
Requires-Dist: fastapi>=0.110.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.6.0
Requires-Dist: rich>=13.7.0
Requires-Dist: typer>=0.12.0
Requires-Dist: uncurl>=0.0.11
Requires-Dist: uvicorn[standard]>=0.29.0
Provides-Extra: dev
Requires-Dist: mypy>=1.10.0; extra == 'dev'
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.4.0; extra == 'dev'
Description-Content-Type: text/markdown

# api-medic

A diagnostic tool for HTTP API issues. Capture or run a request, get a structured report with plain-language findings — DNS, TLS, auth, CORS, rate limiting, body/encoding, redirects, the lot.

Built primarily for technical support engineers triaging customer-reported API issues, but useful for anyone debugging an HTTP integration.

## Try it now (no install)

[**api-medic.markandrewmarquez.com**](https://api-medic.markandrewmarquez.com) — paste a curl command, upload a HAR, or fire a live request from the browser. Live runs are HTTPS-only and throttled; captured-mode (curl/HAR) accepts anything.

## Install

```bash
pip install api-medic
```

Requires Python 3.10+.

## Quickstart

```bash
# Quickest possible diagnosis
api-medic https://api.example.com/v1/users

# Full request with method + headers + body
api-medic run https://api.example.com/v1/users \
    --method POST \
    --header "Authorization: Bearer ..." \
    --header "Content-Type: application/json" \
    --body '{"name": "Alex Doe"}'

# Analyze a curl command without re-running it
api-medic from-curl 'curl -X POST https://api.example.com/v1/users -H "Authorization: Bearer ..." -d ''{"name": "Alex Doe"}'''

# Analyze a HAR file (export from browser DevTools → Network → Save HAR)
api-medic from-har session.har

# Launch the local web UI on http://localhost:8765
api-medic serve
```

Output formats: `--output {terminal,json,markdown,html}`, default terminal.

## What gets checked

Twenty-plus diagnostic checks across:

- **Network:** DNS resolution, no records, address-class issues
- **TLS:** cert expiry, hostname mismatch, expiring soon, weak protocol
- **Transport:** redirect loops, redirect-to-http, slow TLS handshake
- **Auth:** JWT expiry, missing/malformed Authorization, suspicious signature
- **CORS:** preflight failures, origin not allowed, credentials misconfigured
- **Body:** malformed JSON, Content-Length mismatch, Content-Encoding mismatch
- **Rate limiting:** 429 with Retry-After surfaced as a finding
- **Status:** 4xx/5xx routing, server errors with body context

Every check produces the same `Report` shape — same fields, same JSON schema — whether it ran in the CLI, local web UI, or hosted demo. See [`docs/architecture.md`](docs/architecture.md) for the full check list and data model.

## Architecture

Three input surfaces, one core engine:

- **CLI** (`api-medic ...`): full feature set, terminal/JSON/MD/HTML output
- **Local web UI** (`api-medic serve`): same engine, browser frontend
- **Hosted demo** (`api-medic.markandrewmarquez.com`): captured + live, SSRF-guarded, throttled

Shared `Report` shape across all three surfaces — a CLI report and a hosted-demo report are byte-identical given the same input.

## Contributing

Issues and PRs welcome at [github.com/marky224/api-medic](https://github.com/marky224/api-medic). See [`docs/architecture.md`](docs/architecture.md) for the design rationale before proposing larger changes.

## License

MIT — see [LICENSE](LICENSE).
