Created
March 28, 2020 13:28
-
-
Save ST2-EV/11975ce1c667804524308eec53171e6c to your computer and use it in GitHub Desktop.
Check if a website is active or not in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def does_it_exist(link): | |
parsed_uri = urlparse(link) | |
domain = '{uri.scheme}'.format(uri=parsed_uri)+'://'+'{uri.netloc}/'.format(uri=parsed_uri) | |
try: | |
r = requests.get(domain) | |
if r.status_code == 200: | |
return True | |
return False | |
except: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment