Locust Error: HttpError (u#39;405 Client Error: Not Allowed for url: https://..../login#39;)(Locust错误:HTTPError(u#39;405客户端错误:URL:https://..../login#39;)不允许)
本文介绍了Locust错误:HTTPError(u';405客户端错误:URL:https://..../login';)不允许的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试对Web服务器进行负载测试,但我使用self.client.verify = False禁用了该站点的SSL证书。
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
def on_start(self):
self.client.verify = False
@task(1)
def options(self):
self.client.options('//oauth/token')
@task(2)
def login(self):
self.client.post("//oauth/token", {"username":"admin","password":"password","provider":"users","grant_type":"password","client_id":2,"client_secret":"somethinghere","scope":"*"})
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait = 5000
max_wait = 9000
现在有一个错误,内容是:
有人能帮我纠正这个错误吗?谢谢!
推荐答案
您需要将词典转储为字符串
显式:
self.client.post("//oauth/token", json.dumps({"username"...
或隐式使用json参数:
self.client.post("//oauth/token", json={"username"...
(编辑后,一开始我以为问题出在双斜杠上)
这篇关于Locust错误:HTTPError(u';405客户端错误:URL:https://..../login';)不允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:Locust错误:HTTPError(u';405客户端错误:URL:https://..../login';)不允许
基础教程推荐
猜你喜欢
- 无法导入 Pytorch [WinError 126] 找不到指定的模块 2022-01-01
- 求两个直方图的卷积 2022-01-01
- 在同一图形上绘制Bokeh的烛台和音量条 2022-01-01
- 包装空间模型 2022-01-01
- 修改列表中的数据帧不起作用 2022-01-01
- Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙? 2022-01-01
- PermissionError: pip 从 8.1.1 升级到 8.1.2 2022-01-01
- 使用大型矩阵时禁止 Pycharm 输出中的自动换行符 2022-01-01
- PANDA VALUE_COUNTS包含GROUP BY之前的所有值 2022-01-01
- 在Python中从Azure BLOB存储中读取文件 2022-01-01
