Call from Python

PHOTO EMBED

Thu Apr 11 2024 16:58:01 GMT+0000 (Coordinated Universal Time)

Saved by @CarlosR

import requests  
  
def get_data_from_endpoint(host, endpoint, headers):  
    url = f"{host}/{endpoint}"  
    response = requests.get(url, headers=headers)  
      
    if response.status_code == 200:  
        return response.json()  
    else:  
        return f"Error: {response.status_code}"  
  
# Replace with your actual host, endpoint, and headers  
host = "http://172.24.44.8"  
endpoint = "relevancy?application=ResourceAdvisor&utterance=Hello"  
headers = {"Host": "ds-colpilot-nonprod.sb.se.com"}  
print()
print(get_data_from_endpoint(host, endpoint, headers))  
content_copyCOPY