我想测试一个用API的网站,即在此开发阶段被归类为“不安全”。
在蝗虫文档中说:
安全模式:
HTTP客户端被配置为在Safe_mode中运行。这样做的是,由于连接错误,超时或类似原因而失败的任何请求都不会引起异常,而是返回一个空虚拟响应对象。该请求将报告为用户统计信息失败。返回的虚拟响应的内容属性将设置为无,其状态_code为0。
我想知道是否有一种配置使您禁用此选项。
谢谢你的宝贵时间
I would like to test a site with APIs that at this stage of development is classified as "not secure".
In the Locust documentation is said that:
Safe mode:
The HTTP client is configured to run in safe_mode. What this does is that any request that fails due to a connection error, timeout, or similar will not raise an exception, but rather return an empty dummy Response object. The request will be reported as a failure in User’s statistics. The returned dummy Response’s content attribute will be set to None, and its status_code will be 0.
I would like to know if there is a configuration that let you disable this option.
Thank you for your time
发布评论
评论(1)
safe_mode
与SSL/TLS无关,它是指请求
在请求失败时不会引发异常(出于何种原因)。要使HTTPUSER/请求忽略SSL问题,请将
verify = false
添加到您的呼叫中。-
您正在寻找一个非常古老的蝗虫文档,对吗?我不认为您提到的文字已经有一段时间了。
safe_mode
已从request
中删除(它过去看起来像 https://github.com/psf/requests/pull/604 )但是,locust在这里实现了相同的行为https://github.com/locustio/locust/blob/51b1d5038a2be6e2823b2576c4436f2ff9f7c7c2/locust/clients.py#L195safe_mode
has nothing to do with SSL/TLS, it refers torequests
not throwing an exception when the request fails (for whatever reason).To make HttpUser/requests ignore SSL issues, add
verify=False
to your call.——
You're looking at a very old Locust documentation, right? I dont think the text you mention has been there for quite a while.
safe_mode
has been removed fromrequests
(it used to look like this https://github.com/psf/requests/pull/604) but the same behaviour is implemented by Locust here https://github.com/locustio/locust/blob/51b1d5038a2be6e2823b2576c4436f2ff9f7c7c2/locust/clients.py#L195