Skip to content

Instantly share code, notes, and snippets.

@tomoyk
Created March 24, 2022 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomoyk/c9037cdac2e7dc77fe6186fec3ca9b8d to your computer and use it in GitHub Desktop.
Save tomoyk/c9037cdac2e7dc77fe6186fec3ca9b8d to your computer and use it in GitHub Desktop.
from locust import HttpUser, task
import os.path
import glob
import uuid
class StartUser(HttpUser):
@task
def on_start(self):
self.client.get("/")
@task
def uploads(self):
url = "/api/v1/analysis"
upload_files = ("sample.pdf", )
for file_name in upload_files:
with open(file_name, "rb") as file_content:
_file = {'file': file_content}
self.client.post(url, files=_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment