Skip to content

Instantly share code, notes, and snippets.

@pablete
Created April 18, 2015 00:17
Show Gist options
  • Save pablete/a2b8ac7ddf31a3229381 to your computer and use it in GitHub Desktop.
Save pablete/a2b8ac7ddf31a3229381 to your computer and use it in GitHub Desktop.
from locust import HttpLocust, TaskSet, task
import json
import os
json_data=open(os.path.dirname(os.path.abspath(__file__)) + "/small_payload.json").read()
data = json.loads(json_data)
class MyTaskSet(TaskSet):
@task
def my_task(self):
headers = {'content-type': 'application/json'}
self.client.post("/v1/import", data=json_data, headers=headers)
class WebsiteUser(HttpLocust):
task_set = MyTaskSet
min_wait = 200
max_wait = 500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment