Ask coding questions

← Back to all posts
Preventing spamming
211483

So I'm making a backend for a project, which manages the signing up and stuff.
I spammed a few requests as a test:

import threading,requests
def spam_req():
while True:
r=requests.post('https://dbtest.211483m.repl.co/api/add_user',{'test':'spam})
while True:
threading.Thread(target=spam_req).start()

And this lagged down the backend a lot, I couldn't even get into the homepage.

So I tried to ban IPs that spam more than 100 requests an hour, but found out that replit doesn't allow you to see users' IPs.

Do any of you have any idea how to prevent spamming then?

Voters
211483
Comments
hotnewtop
MrVoo

If your database involves writing to a file, it won't work. Use ReplDB

211483

@MrVoo i'm using repldb, im asking how to prevent request spam