You can easily login using Basic Authentication with any LoadForge request by adding the auth parameter to your get or post request object. In this example below, we will try to login as user1 with password password1.
We have two examples, one POST request with data and another GET request with just authentication.
import time
from locust import HttpUser, task, between
class QuickstartUser(HttpUser):
wait_time = between(3, 5)
@task
self.client.get("/myUrl", auth=("user1", "password1"))
self.client.post("/myUrl",
{"item": "123", "button": "submit"},
auth=("user1", "password1")
)