If you're lazy like me, just use `ping` for a basic check (though it won’t catch HTTP errors):
```python
import subprocess
def ping_site():
try:
subprocess.check_output(["ping", "-c", "1", "example.com"])
print("Site is reachable.")
except:
print("Site is down.")
```
Not perfect, but super fast for a quick code to check a website python script.
```python
import subprocess
def ping_site():
try:
subprocess.check_output(["ping", "-c", "1", "example.com"])
print("Site is reachable.")
except:
print("Site is down.")
```
Not perfect, but super fast for a quick code to check a website python script.
