Python GET request doesn't return anything

I'm trying to use an API that is for flight information. On the documentation, it says that this is a rest API and the method is GET. the URL on the Document is:

http://zv.nirasoftware.com:882/AvailabilityJS.jsp?AirLine=ZV&cbSource=THR&cbTarget=MHD&cbDay1=1&cbMonth1=5&cbAdultQty=1&cbChildQty=0&cbInfantQty=0&OfficeUser=TEH.WS&OfficePass=123

when I run the API using chrome I get back the JSON file but using python I don't receive anything! What should I do?

import requests

rs = requests.get("http://zv.nirasoftware.com:882/AvailabilityJS.jsp?AirLine=ZV&cbSource=THR&cbTarget=MHD&cbDay1=1&cbMonth1=5&cbAdultQty=1&cbChildQty=0&cbInfantQty=0&OfficeUser=THE.WSS&OfficePass=124")

print(rs)

2 answers

  • answered 2020-07-04 21:27 salparadise

    rs would be the Response requests object, you want to call json() if there is a json response in the body.

    print(rs.json())
    

  • answered 2020-07-04 21:31 gellerm

    When you get data using the requests module, you can view the response by printing rs.text

    EDIT: the first answerer used the .json() function which is likely better if you want it as a JSON