[英]'Response' object has no attribute 'success' error in Locust
按照我正在做的文檔:
with self.client.request("POST", build_path, headers=self.headers, data=json.dumps(updated_payload.__dict__)) as response:
if response.status_code == 403:
response.success()
raise RuntimeError(f"Non-200 response on calling {build_path}")
但是這段代碼給了我上面的錯誤。 有沒有辦法解決這個錯誤?
僅當您將catch_response
設置為 True 時才有效,否則將不可能。 所以就這樣做
with self.client.request("POST", build_path, headers=self.headers, data=json.dumps(updated_payload.__dict__), catch_response=True) as response:
if response.status_code == 403:
response.success()
raise RuntimeError(f"Non-200 response on calling {build_path}")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.