-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb1b7db
commit 851b8ba
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from locust import HttpUser, task, between | ||
|
||
class ApiLoadRunner(HttpUser): | ||
""" | ||
Sends a POST request to the '/predict' endpoint with a JSON payload. | ||
Args: | ||
self: The instance of the class. | ||
Returns: | ||
None | ||
""" | ||
wait_time = between(0.5, 2.5) | ||
|
||
@task | ||
def request(self): | ||
headers = { | ||
"Content-Type": "application/json" | ||
} | ||
request_body = { | ||
"accelerations": 0, | ||
"fetal_movement": 0, | ||
"uterine_contractions": 0, | ||
"severe_decelerations": 0 | ||
} | ||
self.client.post('/predict', json=request_body, headers=headers) |