Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I get status code 200 with postman but with request.get I get status code 500

When I make the request in postman to this api https://api.bigauto.solutionslion.com/api/store/showApp sending the parameters = { "part_number": "10-659"}
https://ibb.co/QvHvxPw image
I get the response correctly
https://ibb.co/QvHvxPw

But when doing it in python I get code status 500 as if the parameter was not being sent

import requests

parameters = {
    "part_number": "10-659"
}

response = requests.get("https://api.bigauto.solutionslion.com/api/store/showApp", params=parameters)

print(response.status_code)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try to use json= parameter instead params=:

import requests

parameters = {"part_number": "10-659"}

response = requests.get(
    "https://api.bigauto.solutionslion.com/api/store/showApp", json=parameters
)

print(response.status_code)
print(response.json())

Prints:

200
[
    {
        "id": 78399,
        "make": "FORD",
        "make_id": 78,
        "years": [1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994],
        "model": "F-250",
        "model_id": 352,
        "engine_id": "null",
        "cilinders": "null",
        "liters": "null",
        "valves": "null",
        "description": "null",
        "fuel": "null",
    }
]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading