Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from locust import HttpLocust, TaskSet, task
# locust -f --host=
class WebsiteTasks(TaskSet):
# def on_start(self):
#"/login", {
# "username": "test_user",
# "password": ""
# })
def get(self):
response = self.client.get("/get")
print "Create; Response status code:", response.status_code
def post(self):
with open('resources/xac/xacml.xml', 'r') as content_file:
content =
payload = content
headers = {"Content-Type": "application/xml"}
response ="/post", data=payload, headers=headers)
print "Create; Response status code:", response.status_code
class WebsiteUser(HttpLocust):
task_set = WebsiteTasks
min_wait = 5000
max_wait = 15000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.