<commit_before>=============
Quick start
=============

Example locustfile.py
=====================

Below is a quick little example of a simple **locustfile.py**::

    from locust import HttpLocust, TaskSet
    
    def login(l):
        l.client.post("/login", {"username":"ellen_key", "password":"<PASSWORD>"})
    
    def index(l):
        l.client.get("/")
    
    def profile(l):
        l.client.get("/profile")
    
    class UserBehavior(TaskSet):
        tasks = {index: 2, profile: 1}
        
        def on_start(self):
            login(self)
    
    class WebsiteUser(HttpLocust):
        task_set = UserBehavior
        min_wait = 5000
        max_wait = 9000
    

Here we define a number of Locust tasks, which are normal Python callables that take one argument
(a :py:class:`Locust <locust.core.Locust>` class instance). These tasks are gathered under a
:py:class:`TaskSet <locust.core.TaskSet>` class in the *tasks* attribute. Then we have a
:py:class:`HttpLocust <locust.core.HttpLocust>` class which represents a user, where we define how
long a simulated user should wait between executing tasks, as well as what
:py:class:`TaskSet <locust.core.TaskSet>` class should define the user's "behaviour".
:py:class:`TaskSet <locust.core.TaskSet>`s can be nested.

The :py:class:`HttpLocust <locust.core.HttpLocust>` class inherits from the<commit_msg>RST syntax fix<commit_after>=============
Quick start
=============

Example locustfile.py
=====================

Below is a quick little example of a simple **locustfile.py**::

    from locust import HttpLocust, TaskSet
    
    def login(l):
        l.client.post("/login", {"username":"ellen_key", "password":"<PASSWORD>"})
    
    def index(l):
        l.client.get("/")
    
    def profile(l):
        l.client.get("/profile")
    
    class UserBehavior(TaskSet):
        tasks = {index: 2, profile: 1}
        
        def on_start(self):
            login(self)
    
    class WebsiteUser(HttpLocust):
        task_set = UserBehavior
        min_wait = 5000
        max_wait = 9000


Here we define a number of Locust tasks, which are normal Python callables that take one argument 
(a :py:class:`Locust <locust.core.Locust>` class instance). These tasks are gathered under a
:py:class:`TaskSet <locust.core.TaskSet>` class in the *tasks* attribute. Then we have a
:py:class:`HttpLocust <locust.core.HttpLocust>` class which represents a user, where we define how
long a simulated user should wait between executing tasks, as well as what
:py:class:`TaskSet <locust.core.TaskSet>` class should define the user's \"behaviour\". 
:py:class:`TaskSet <locust.core.TaskSet>` classes can be nested.

The :py:class:`HttpLocust <locust.core.HttpLocust>` class inherits from the
{'fraction_non_alphanumeric': 0.14098837209302326, 'fraction_numerical': 0.007267441860465116, 'mean_word_length': 3.4403225806451614, 'pattern_counts': {'":': 4, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2805051', 'n_tokens_mistral': 859, 'n_tokens_neox': 808, 'n_words': 266}