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';)不允许
猜你喜欢
- CTR 中的 AES 如何用于 Python 和 PyCrypto? 2022-01-01
- 如何使用PYSPARK从Spark获得批次行 2022-01-01
- 我如何卸载 PyTorch? 2022-01-01
- 检查具有纬度和经度的地理点是否在 shapefile 中 2022-01-01
- 计算测试数量的Python单元测试 2022-01-01
- YouTube API v3 返回截断的观看记录 2022-01-01
- 使用公司代理使Python3.x Slack(松弛客户端) 2022-01-01
- 我如何透明地重定向一个Python导入? 2022-01-01
- 使用 Cython 将 Python 链接到共享库 2022-01-01
- ";find_element_by_name(';name';)";和&QOOT;FIND_ELEMENT(BY NAME,';NAME';)";之间有什么区别? 2022-01-01
