Skip to content

Logging in several times in a row too quickly causes an error #86

Description

@dandroid126

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions