Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Question】How can I send https request with locust? #468

Closed
yisake opened this issue Sep 2, 2016 · 5 comments
Closed

【Question】How can I send https request with locust? #468

yisake opened this issue Sep 2, 2016 · 5 comments

Comments

@yisake
Copy link

yisake commented Sep 2, 2016

As title.

@heyman
Copy link
Member

heyman commented Sep 2, 2016

Read the documentation (http://docs.locust.io). You can start here: http://docs.locust.io/en/latest/quickstart.html

@heyman heyman closed this as completed Sep 2, 2016
@axd1967
Copy link

axd1967 commented May 19, 2017

That is a totally useless answer. This is a nontrivial question, you could at least point to a more specific page; at first sight, Locust only allows to test against HTTP.
http://docs.locust.io/en/latest/search.html?q=https&check_keywords=yes&area=default

this is probably the best a user can use, and still unusable:
http://docs.locust.io/en/latest/testing-other-systems.html

@cgoldberg
Copy link
Member

Locust only allows to test against HTTP

completely false.

@VincentHokie
Copy link

I know this is an old post, but this did it for me.

@digitaldybbuk
Copy link

For people who actually have to make HTTPS requests with certs,
note that x.client.post, x.client.get, etc.. wraps around requests:

def post(self, url, data=None, json=None, **kwargs): Sends a POST request. Returns :class:Response` object.

    :param url: URL for the new :class:`Request` object.
    :param data: (optional) Dictionary, list of tuples, bytes, or file-like
        object to send in the body of the :class:`Request`.
    :param json: (optional) json to send in the body of the :class:`Request`.
    :param \*\*kwargs: Optional arguments that ``request`` takes.
    :rtype: requests.Response
   `

so just simply do the following:

l.client.post("/login", {"username":"someuser", "password":"somepassword"}, cert=(PATH_TO_MY_CERT, PATH_TO_MY_KEY_FILE), verify=PATH_TO_CA_BUNDLE_OR_FALSE)

Note that cert=<CAN ALSO BE A .PEM FILE>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants