We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I tried to use locust client to upload a file but I always get request.FILES.get('photo')=None on server side (If I use POSTMAN I am getting the file)
@task def post_img(self): with open('img.jpg', 'rb') as image: payload = {'id': self.id, 'photo': image} upload_result = self.client.post("/image/", payload)
Also tried the following:
@task def post_img(self): with open('img.jpg', 'rb') as image: payload = {'id': self.id} upload_result = self.client.post("/image/", data=payload, files=image)
The text was updated successfully, but these errors were encountered:
Try specifying the name of the field for files
files
@task def post_img(self): with open('img.jpg', 'rb') as image: self.client.post( "/image/", data={'id': self.id}, files={'photo': image} )
As per http://docs.python-requests.org/en/master/user/quickstart/#post-a-multipart-encoded-file
Sorry, something went wrong.
No branches or pull requests
I tried to use locust client to upload a file but I always get request.FILES.get('photo')=None on server side (If I use POSTMAN I am getting the file)
Also tried the following:
The text was updated successfully, but these errors were encountered: