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開始。 –