How to handle API response in python
How to handle API response in python Question: I wonder how I can properly handle this invalid response. How to check if the response has status: 400 or perhaps has a title: Bad Request? url = f"https://api123.com" substring = "title: Bad Request" response = requests.get(url, headers=headers).json() if substring in response: print ("Your Data is Invalid") …