postmanlabs / postmanlabs/postman-code-generators
Python - Requests generated code doesn't work
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 381
- PR merge metrics
- No merged PRs in 30d
Description
Description: When running the code generator for Python - Requests, it generated a script that gets a 400 response doing a POST to ArcGI :
b'{"error":{"code":400,"error":"invalid_request","error_description":"client_id not specified","message":"client_id not specified","details":[]}}'
Reproduce: Create a POST request to https://www.arcgis.com/sharing/rest/oauth2/token using:
'client_id': "your_client_id",
'client_secret': "your_client_secret",
'grant_type': "client_credentials"
Then use the code generation for Python - Requests and try to run the script
Expected code snippet and corresponding request
The fix in the python generated code was to change the data variable called in:
response = requests.request("POST", url, headers=headers, data = payload, files = files)
to instead say (data => params):
response = requests.request("POST", url, headers=headers, params=payload, files=files)
Screenshots


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 with the Python - Requests code generator and reproduce the ArcGIS OAuth token request described in the issue. Compare the generated call with the expected snippet, then verify that the generated request uses the payload in the expected argument and no longer produces the reported missing-client_id response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100