Django Integration

Integrate VerifyWall with Django in minutes

Add fraud detection to your Django application using Python's requests library and Django's view system.

1

Install dependencies

Install the requests library and add your API key to Django settings.

pip install requests
2

Create an API client

Create a service module that wraps the VerifyWall API. Import Django settings to access your API key.

import requests
from django.conf import settings

def check(subject):
    response = requests.get(
        f"{settings.VERIFYWALL_URL}/v1/check",
        headers={
            "Authorization": f"Bearer {settings.VERIFYWALL_API_KEY}",
        },
        params={"q": subject},
    )
    response.raise_for_status()
    return response.json()["data"]["attributes"]
3

Add to your registration view

Call VerifyWall in your registration view to evaluate risk before creating user accounts.

from django.http import JsonResponse
from django.contrib.auth import login
from services.verifywall import check

def register(request):
    if request.method != "POST":
        return render(request, "register.html")

    email = request.POST["email"]
    password = request.POST["password"]

    result = check(email)

    if result["risk_level"] == "high":
        return JsonResponse(
            {"error": "Registration blocked."},
            status=422,
        )

    user = User.objects.create_user(
        email=email,
        password=password,
    )
    user.risk_score = result["risk_score"]
    user.save()

    login(request, user)
    return redirect("/dashboard")
4

Test the integration

Test from the Django shell to confirm your API key and connection are working.

# Run: python manage.py shell
from services.verifywall import check

result = check("[email protected]")
print(result)
# {'risk_score': 65, 'risk_level': 'high', ...}

Frequently asked questions

Does VerifyWall work with Django REST Framework?

Yes. Call the check function in your DRF serializer validate() method or in the view perform_create() hook. The integration pattern is identical — only the Django entry point differs.

Can I run the verification in a Celery task?

Yes. Dispatch a Celery task after registration to check the user asynchronously. Update a risk_score field on the user model and use Django signals or periodic checks to flag high-risk accounts.

How do I handle API timeouts in Django?

Pass a timeout parameter to requests.get(): requests.get(url, params=params, timeout=5). This ensures your registration flow is not blocked if the API is temporarily slow. You can also wrap the call in a try/except and allow the signup through if the API is unreachable.

Ready to integrate?

Get your API key and start protecting your Django application in minutes.