/
ibragimov
/
load-test
Обзор
Документация
Войти
/
ibragimov
/
load-test
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
locustfile2.py
48 строк
2 KB
Adel
init
14 фев 2026, 17:30
14 фев 2026, 17:30
95f5f11
Код
Авторство
О чём код?
from locust import task, run_single_user from locust import FastHttpUser class localhost_Archive__26_01_29_12_06_16_(FastHttpUser): host = "http://localhost:8000" default_headers = { "Accept-Encoding": "gzip, deflate, br, zstd", "Accept-Language": "en-US,en;q=0.9", "Connection": "keep-alive", "Host": "localhost:8000", "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:148.0) Gecko/20100101 Firefox/148.0", } @task def t(self): with self.client.request( "GET", "/api/v1/hello", headers={ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Priority": "u=0, i", "Sec-Fetch-Dest": "document", "Sec-Fetch-Mode": "navigate", "Sec-Fetch-Site": "none", "Sec-Fetch-User": "?1", "Upgrade-Insecure-Requests": "1", }, catch_response=True, ) as resp: pass with self.rest( "GET", "/favicon.ico", headers={ "Accept": "image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5", "Priority": "u=6", "Referer": "http://localhost:8000/api/v1/hello", "Sec-Fetch-Dest": "image", "Sec-Fetch-Mode": "no-cors", "Sec-Fetch-Site": "same-origin", }, ) as resp: pass if __name__ == "__main__": run_single_user(localhost_Archive__26_01_29_12_06_16_)