postmanlabs / postmanlabs/postman-code-generators

Python - Requests generated code doesn't work

Open
#215 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

codegen
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
Screen Shot 2020-03-14 at 7 21 48 PM
Screen Shot 2020-03-14 at 7 22 33 PM

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.