Search code examples
pythonapipython-requestscisco

Python's request.get only show 200 status


I'm trying to workd with the Cisco Prime API, and it seems to work when using Postman (the output is an xml file). However, when I try to reproduce the same with Python:

request.get(url, verify=False, auth=credentials)
print(response)

the only response I get is <Response [200]> (and a warning for disabling SSL, but that's not relevant)... I use requests.auth.HTTPBasicAuth to generate the "crdentials" variable


Solution

  • Well, of course, it's just after posting this that I found the answer: first, you need to search for the json, not the xml and second, when you want to cast the json, you need do response.json()