Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
Locust Test payload with files

this is my first question and I would like to know how to send the following test parameters to my FastAPI API:

to: (string)
name: (string)
files: (array)

what is the correct syntax? I am trying with the following:

self.client.post ("/ email", dict (to = "", name = "", files = "hi.pdf"))
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Here's the Locust doc on post requests. https://docs.locust.io/en/stable/api.html#locust.clients.HttpSession.post

Locust's http classes are based on requests. There are multiple ways to do it. One way is to read file directly and post it by itself:

with open("hi.pdf", "rb") as hi:
    self.client.post("/email", data=hi.read())

I'm not familiar with FastAPI so I don't know where your to and name need to go. If they're headers, you can do:

with open("hi.pdf", "rb") as hi:
    self.client.post("/email", data=hi.read(), headers={"to": "", "name": ""})
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!