We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi guys, I'm trying to do post requests with a nested dictionary, but it does not seem to work. My code:
from locust import HttpLocust, TaskSet, task import random class UserBehavior(TaskSet): def on_start(self): return 0 @task(2) def index(self): to_send = { "object": "page", "entry": [ { "id": random.randint(1, 10000), "time": random.randint(1000000, 100000000), "messaging": [ { "message": { "seq": random.randint(1, 1000), "text": "Hello World" }, "recipient": { "id": random.randint(1, 10000) }, "sender": { "id": random.randint(1, 10000) }, "timestamp": random.randint(1000000, 1000000000) } ] } ] } self.client.post("/api/incoming/facebook", to_send) class WebsiteUser(HttpLocust): task_set = UserBehavior min_wait=5000 max_wait=9000
On my server, I'm only getting: %{"entry" => "time", "object" => "page"}
%{"entry" => "time", "object" => "page"}
The text was updated successfully, but these errors were encountered:
Hi! Locust uses python Requests library.
If you're trying to post the dictionary as a JSON blob you could use the json keyword argument in the post() method. Like this:
json
post()
self.client.post("/api/incoming/facebook", json=to_send)
Sorry, something went wrong.
No branches or pull requests
Hi guys, I'm trying to do post requests with a nested dictionary, but it does not seem to work. My code:
On my server, I'm only getting:
%{"entry" => "time", "object" => "page"}
The text was updated successfully, but these errors were encountered: