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))
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter