1
在我的本地主机(127.0.0.1:8089)与蝗虫试过,但它提供了400坏请求错误:如何以编程方式调用Locust测试?
import requests
response = requests.post('http://127.0.0.1:8089/swarm', params={"locust_count":10, "hatch_rate":5})
print response.text
响应:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>400 Bad Request</title>
<h1>Bad Request</h1>
<p>The browser (or proxy) sent a request that this server could not understand.</p>
我已经验证了http://127.0.0.1:8089/确实达通过浏览器浏览它。 locustfile.py
的代码可在this post处获得。
感谢Abhimanyu的回复。我会尝试选项#1开始。 –