Skip to main content

Official Python SDK for Verifence — the pre-send firewall for SMS verification.

Project description

Verifence Python SDK

Official Python client for Verifence — the pre-send firewall for SMS verification. Zero dependencies (standard library only, Python ≥ 3.8).

pip install verifence

Your API key is a secret. Every call is server-to-server. Read it from an environment variable; never ship it in client code.

Usage

import os
from verifence import Verifence, QuotaExceededError

vf = Verifence(os.environ["VERIFENCE_KEY"])

# Before you hand a message to Twilio/Vonage/etc:
verdict = vf.check(
    phone="+14155552671",
    client_ip=request.remote_addr,   # the END USER's IP, from your inbound request
    user_id="u_123",
)

if not verdict["allow"]:
    # Do not send — you just saved the message fee.
    return "too_many_verification_requests", 429

# ... send the SMS with your provider ...

# After the user enters the correct code:
vf.confirm(client_ip=request.remote_addr)

Handle a spent quota:

try:
    verdict = vf.check("+14155552671", ip)
except QuotaExceededError as e:
    print("quota resets at", e.resets_at)

API

Method Returns
check(phone, client_ip, user_id=None, require_mobile=False) {"allow": bool, "reason": str | None, "detail": str, "degraded": bool, ...}
confirm(client_ip) {"recorded": bool}
stats() account totals

A block is a 200 with allow=False — not an exception. Only bad input, auth, and quota (429) raise. Self-hosting? Verifence(key, base_url="https://verifence.internal").

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

verifence-0.1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

verifence-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file verifence-0.1.0.tar.gz.

File metadata

  • Download URL: verifence-0.1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for verifence-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7b7cd8aa55a8cb595f849d80ccafc4d986b2b8f4e01c25a47f24a5a372eb9d91
MD5 9b6c86883911197bf8dbdd5f8e50fb87
BLAKE2b-256 d2a52fa519a397159c7f0b33b240112b7b4e5263d625f23fffee7d6b1e8ac8f3

See more details on using hashes here.

File details

Details for the file verifence-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: verifence-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for verifence-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9b97afa8a555b8eb9f4a17fa13dd7ae84c6081a454c8b3013537aa79f086eb5
MD5 1b06b05b78d28274694114fcd666b8ec
BLAKE2b-256 39614cf5361f6177d9aaeb4c024853ddac5c0f1d97be253c02ad101d058dc7ea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page