Created
April 18, 2019 12:31
-
-
Save DataGreed/c893fecac5b18bb5f801cf63580234ce to your computer and use it in GitHub Desktop.
Locust.io post file
This file contains hidden or 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
| from locust import TaskSet, task | |
| class UserBehaviour(TaskSet): | |
| @task | |
| def someTask(self): | |
| filename="some/file.jpg" | |
| with open(filename, 'rb') as img: | |
| self.client.post( | |
| "/some/url", | |
| data={ | |
| "someOtherData": "foo", | |
| }, | |
| files={ | |
| "profile[photo]": ( | |
| 'default.jpg', | |
| img, | |
| 'image/jpeg' | |
| ) | |
| } | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment