Integrate VerifyWall with Python in minutes
Add fraud detection to your Flask, FastAPI, or Django application using the requests library.
Install the HTTP client
Install the requests library and store your API key as an environment variable.
pip install requestsCreate a verification client
Create a Python module that wraps the VerifyWall API. This works with Flask, FastAPI, Django, or any Python framework.
import os
import requests
VERIFYWALL_URL = os.getenv("VERIFYWALL_URL", "https://api.verifywall.com")
VERIFYWALL_KEY = os.getenv("VERIFYWALL_API_KEY")
def verify(email=None, ip=None):
response = requests.post(
f"{VERIFYWALL_URL}/v1/verify",
headers={"Authorization": f"Bearer {VERIFYWALL_KEY}"},
json={"email": email, "ip": ip},
)
response.raise_for_status()
return response.json()["data"]["attributes"]
def check(subject):
response = requests.get(
f"{VERIFYWALL_URL}/v1/check",
headers={"Authorization": f"Bearer {VERIFYWALL_KEY}"},
params={"q": subject},
)
response.raise_for_status()
return response.json()["data"]["attributes"]Add to your registration route
Call VerifyWall in your Flask or FastAPI registration endpoint to evaluate risk before creating accounts.
from verifywall import verify
@app.route("/register", methods=["POST"])
def register():
email = request.form["email"]
password = request.form["password"]
risk = verify(email=email, ip=request.remote_addr)
if risk["risk_level"] == "high":
return jsonify({"error": "We could not verify your identity."}), 422
user = User.create(
email=email,
password=generate_password_hash(password),
risk_score=risk["risk_score"],
)
login_user(user)
return redirect("/dashboard")Verify the integration
Test with a quick Python script to confirm the API key and connection are working.
from verifywall import verify
result = verify(email="[email protected]")
print(result)
# {'risk_score': 65, 'risk_level': 'high', ...}Frequently asked questions
Does VerifyWall work with Flask, FastAPI, and Django?
Yes. VerifyWall is a REST API called via the requests library, which works with any Python web framework. The verification client module is framework-agnostic.
Can I use httpx instead of requests?
Absolutely. The httpx library is a drop-in replacement for requests with async support. Replace requests.post() with httpx.post() (or await httpx.AsyncClient().post() for async) and everything else remains the same.
Is there an official Python SDK?
Not yet. The API is straightforward enough that a requests wrapper is typically all you need. The client module shown above handles both endpoints in under 20 lines of code.
Related resources
Detection Methods
Documentation
Ready to integrate?
Get your API key and start protecting your Python application in minutes.