Executing a simple API call using requests. Receiving NO output and return code is success. Could use some help to identify my deficiency, please see below:
SCRIPT:
# <snip>
# Install the Python Requests library:
# `pip install requests`
import requests
def send_request():
try:
response = requests.get(
url="https://<REDACTED>",
headers={
"Accept": "application/json",
"Content-Type": "application/json",
"X-ApiKeys": "<REDACTED>",
"Cookie": "nginx-cloud-site-id=mssp-us-1",
},
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')
# </snip>
OUTPUT:
TJONES-MB:Desktop user$ python3 ./APITestScript.py
TJONES-MB:Desktop user$ echo $?
0