Metadata-Version: 2.4
Name: harbor-client
Version: 0.1.0
Summary: Add API key auth and billing to your Python API in one line. Harbor handles validation so your users can authenticate with keys they manage from the Harbor dashboard.
Project-URL: Homepage, https://harbor-black.vercel.app
Project-URL: Documentation, https://harbor-black.vercel.app/docs
Project-URL: Repository, https://github.com/nicolugo0503-glitch/harbor-python
License: MIT
Keywords: api,authentication,billing,harbor,middleware
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Requires-Dist: httpx>=0.24.0
Provides-Extra: all
Requires-Dist: django>=3.2; extra == 'all'
Requires-Dist: fastapi>=0.95.0; extra == 'all'
Requires-Dist: flask>=2.0; extra == 'all'
Requires-Dist: starlette>=0.27.0; extra == 'all'
Provides-Extra: django
Requires-Dist: django>=3.2; extra == 'django'
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.95.0; extra == 'fastapi'
Requires-Dist: starlette>=0.27.0; extra == 'fastapi'
Provides-Extra: flask
Requires-Dist: flask>=2.0; extra == 'flask'
Description-Content-Type: text/markdown

# harbor-sdk for Python

Add API key auth and billing to your Python API in one line.

## Install

```bash
pip install harbor-sdk
```

## Quick Start

### Flask
```python
from flask import Flask, jsonify, g
from harbor_sdk import harbor

app = Flask(__name__)

@app.route("/data")
@harbor(project_id="proj_harbor_xyz")
def data():
    plan = g.harbor.plan  # 'free' | 'pro' | 'scale'
    return jsonify({"data": "protected", "plan": plan})
```

### FastAPI
```python
from fastapi import FastAPI, Request
from harbor_sdk import HarborMiddleware

app = FastAPI()
app.add_middleware(HarborMiddleware, project_id="proj_harbor_xyz")

@app.get("/data")
async def data(request: Request):
    plan = request.state.harbor.plan
    return {"data": "protected", "plan": plan}
```

### Manual validation
```python
from harbor_sdk import validate

info = validate(request.headers.get("X-Harbor-Key"))
if not info:
    return {"error": "Invalid API key"}, 401
print(info.plan)         # 'pro'
print(info.key_id)       # 'key_abc123'
print(info.project_id)   # 'proj_harbor_xyz'
```

## Your users pass their key in the header

```bash
curl -H "X-Harbor-Key: hbr_live_..." https://your-api.com/data
```

## Get your Project ID

1. Sign up at [harbor-black.vercel.app](https://harbor-black.vercel.app)
2. Create a project in your dashboard
3. Copy your Project ID

Full docs: [harbor-black.vercel.app/docs](https://harbor-black.vercel.app/docs)
