Aug-04-2017, 09:01 PM
I am using a libre requests. I am trying to check out localhost and if it is working then to type the message "Yes". If it isn't working then to type the message "No". Now my localhost is working and after I run my script I get the message "Yest" and it is normally. But when my localhost isn't working I don't get the message "No" . I only get a stack of errors.
Here is my code:
Here is my code:
import requests url = 'http://localhost:8000' response = requests.get(url) if response.status_code == 200: print("Yes ...") else: print("No ...")Why doesn't it type the message "No" when the localhost isn't working ?