Python integration

Refuse disposable emails and repeat signups in Python

Call our Python function in your signup view before you create the user. When it returns a message, refuse the signup and show that message.

  1. Get a free key: confirm your email, then make one on the Integration tab.
  2. Save our file as signupbouncer.py in your Django, Flask, FastAPI or other Python project. It uses only Python's standard library.
  3. Set SIGNUPBOUNCER_API_KEY in your server's environment to your key. Then call signup_refusal(email, ip). None means the signup can go ahead.
  4. Sign up with a test address, and find the signup on the Checks tab. We don't refuse signups until you switch the app to enforce.

What SignupBouncer refuses

Your code sends us the new user's email address, and the IP address if you pass it. On every plan, we check the email for:

  • a disposable domain, or a domain whose mail goes to a known burner mail server
  • a domain that can't receive email
  • the same inbox under another spelling, such as Gmail dots or a +tag

We check each signup's IP for datacenters, VPNs, Tor and hijacked networks, on every plan. From Starter up, that can flag or refuse the signup.

You wait at most 1.5 seconds for our answer. If we don't answer in time, or answer with an error, the signup goes through.

Full setup in the docs

Read the Python page in our docs. We explain there which header to take the IP address from. If you're unsure, leave the IP out.

Start on the Free plan

1 app and 1,000 checks a month, with no card. Until you switch to enforce, the Checks tab shows signups we'd refuse.