pythorhead
pythorhead copied to clipboard
Logging in several times in a row too quickly causes an error
Lemmy instance version: 0.19.1 pythorhead version: 0.20.0
Using the following script, an error is thrown (replace example values with real ones):
from pythorhead import Lemmy
lemmy = Lemmy("https://example.com")
lemmy.log_in("username", "password")
lemmy.log_in("username", "password")
lemmy.log_in("username", "password")
The error:
Error encountered while Request.POST on endpoint /user/login: {"error":"unknown","message":"duplicate key value violates unique constraint \"login_token_pkey\""}
I think it is worth noting that using this script does not cause the error to be thrown:
from pythorhead import Lemmy
import time
lemmy = Lemmy("https://example.com")
lemmy.log_in("username", "password")
time.sleep(1)
lemmy.log_in("username", "password")
time.sleep(1)
lemmy.log_in("username", "password")