Metadata-Version: 2.4
Name: celonix-otp
Version: 1.0.0
Summary: WhatsApp OTP authentication for Python apps (Flask, Django, FastAPI)
Home-page: https://celonix.in
Author: Celonix
Author-email: admin@celonix.in
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Security
Classifier: Topic :: Communications :: Chat
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.25.0
Requires-Dist: python-dotenv>=0.19.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

markdown
# Celonix OTP - Python

WhatsApp OTP authentication for Python applications.

Works with Flask, Django, FastAPI, or any Python framework.

## Install

```bash
pip install celonix-otp
Usage
python
from celonix_otp import CelonixOTP

otp = CelonixOTP()

# Send OTP
request_id = otp.send_otp("919876543210", "https://myapp.com")
print(f"OTP sent! Request ID: {request_id}")

# Verify OTP
is_valid = otp.verify_otp(request_id, "472891")
if is_valid:
    print("Login successful!")
else:
    print("Wrong OTP")
Flask Example
python
from flask import Flask, request, jsonify
from celonix_otp import CelonixOTP

app = Flask(__name__)
otp = CelonixOTP()

@app.route("/send-otp", methods=["POST"])
def send_otp():
    phone = request.json.get("phone")
    origin = request.headers.get("Origin", "")
    try:
        request_id = otp.send_otp(phone, origin)
        return jsonify({"request_id": request_id, "status": "sent"})
    except Exception as e:
        return jsonify({"error": str(e)}), 400

@app.route("/verify-otp", methods=["POST"])
def verify_otp():
    request_id = request.json.get("request_id")
    otp_code = request.json.get("otp")
    try:
        is_valid = otp.verify_otp(request_id, otp_code)
        return jsonify({"verified": is_valid})
    except Exception as e:
        return jsonify({"error": str(e)}), 400

if __name__ == "__main__":
    app.run(debug=True)
Django Example
python
# views.py
from django.http import JsonResponse
from celonix_otp import CelonixOTP

otp = CelonixOTP()

def send_otp_view(request):
    phone = request.POST.get("phone")
    origin = request.META.get("HTTP_ORIGIN", "")
    try:
        request_id = otp.send_otp(phone, origin)
        return JsonResponse({"request_id": request_id})
    except Exception as e:
        return JsonResponse({"error": str(e)}, status=400)

def verify_otp_view(request):
    request_id = request.POST.get("request_id")
    otp_code = request.POST.get("otp")
    try:
        is_valid = otp.verify_otp(request_id, otp_code)
        return JsonResponse({"verified": is_valid})
    except Exception as e:
        return JsonResponse({"error": str(e)}, status=400)
FastAPI Example
python
from fastapi import FastAPI, Request
from celonix_otp import CelonixOTP

app = FastAPI()
otp = CelonixOTP()

@app.post("/send-otp")
async def send_otp(request: Request):
    data = await request.json()
    origin = request.headers.get("origin", "")
    request_id = otp.send_otp(data["phone"], origin)
    return {"request_id": request_id}

@app.post("/verify-otp")
async def verify_otp(data: dict):
    is_valid = otp.verify_otp(data["request_id"], data["otp"])
    return {"verified": is_valid}
Need Domain Whitelisting?
Send your website URL to admin@celonix.in

text

Save the file.

Tell me when done.
