Hi, while calling API, and converting its response to jason and print it thru utter_message is working well in code. But i want to return response code along with response. Please help me suggest how to do that.
url = api_address + app_id response = requests.get(url) data = response.json() dispatcher.utter_message(data)
api has 3 response codes - 200 for successful , 400 for invalid id, 401 for record does not exist. I want it like in if else conditions based on response code but could not able to fetch response code. Please advice how to do that
if response code == 200: dispatcher.utter_message(data) else if response code == 400: print(pass correct data) else if response code is 401: print - record does not exist
How to pick response code from response returned from api.
Thanks