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

Stress test with probobuf format? #543

Closed
NingLu opened this issue Feb 19, 2017 · 1 comment
Closed

Stress test with probobuf format? #543

NingLu opened this issue Feb 19, 2017 · 1 comment

Comments

@NingLu
Copy link

NingLu commented Feb 19, 2017

We want to perform stress test on a http api with pb format, but, how to send http request in protobuf format by locust(instead, jmeter supports pb format) .

Is this the same with uploading file?
`files = {
'image': open('sample.jpg', 'rb'),
}

r = requests.post('http://localhost:5000/', files=files)`

@heyman
Copy link
Member

heyman commented Feb 19, 2017

As far as I know, protobuf is just a format for serializing/deserializing structured data - with existing libraries for python - so there shouldn't be any problem using it with Locust.

Exactly how depends on how the server expects the data to get transfered. If it expects it to be transfered as a multipart file upload you would use the files keyword argument (http://docs.python-requests.org/en/master/user/quickstart/#post-a-multipart-encoded-file). However, if I would guess, I would think that it's more likely that the data were to be transfered as raw data in the POST body:

self.client.post("/some/url", data=my_protobuf_data)

@heyman heyman closed this as completed Feb 19, 2017
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

2 participants