I'm quite new to coding. I've wrote a simple piece of code which will take a URL as an input, load the URL and put the status code for that URL in a variable. I have put this in a function. But when I run the code I get no errors and yet the function won't run. It seems like the interpreter is just flying past my function. I know I have some simple error but no matter how much I search I can't fix it. Please help me understand. Oh, and the code is incomplete. But the function should run.
import urllib.request, click, threading
url = input("Enter domain name >> \n")
def get_stat():
status = urllib.request.urlopen("http://"+url).getcode()
if status == 200:
return "Site loads normally!\nHost Said: '%s'!" %(str(status))
else:
return "Site Needs To Be Checked!\nHost Said: '%s'!" %(str(status))
get_stat()
if click.confirm("Would you like to set a uptime watch?"):
click.echo("You just confirmed something!!")
count = input("Enter the number of times you wish your site to be checked: ")
interval = input("Enter the time interval for status requests (Time is in minutes): ")