postmanlabs / postmanlabs/postman-code-generators
Python Generator generates not string form-data
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 381
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Hi there Postman-Team,
I noticed that the code generator for python has issues with a edge case of form-data. I send a zip file along with a string as form-data. Here is a screenshot (I will export the request for u as well :))

To Reproduce
Import the collection and try out the code generation.
Okay I tried to add the json file, but it is not allowed. (You should support that since this is your export format). Here as zip:
export.postman_collection.json.zip
Expected code snippet and corresponding request
I adapted the generated code and the following did work for me:
`
import requests
url = "http://127.0.0.1:5002/executors"
payload={}
files=[
('executor',('iris_classifier.zip',open('/Users/r2d2/dev/IAPP-TESTING/iris_classifier.zip','rb'),'application/zip')),
('executor_name', (None,'name',None))
]
headers = {
'auth_key': '123'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
`
POSTMAN VERSION
I used Version 9.31.0 (9.31.0) on macosx.
Thx in advance. I hope this helps you to improve your already great product even further <3.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by importing the attached export.postman_collection.json.zip and generating the Python request for its multipart form-data body. Compare the generated output with the working requests example in the issue, focusing on the zip file and string field; done means both fields are represented correctly and the generated request works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100