Need a simple code to check a website in Python—any recommendations? or What’s the best code to check

16 Replies, 1005 Views

For a no-frills code to check a website python script, this `requests` one-liner works:

```python
print("Up" if requests.get("https://example.com").status_code == 200 else "Down")
```

But add a `timeout` unless you wanna hang forever. For scheduling, `apscheduler` is solid.

Messages In This Thread



Users browsing this thread: 1 Guest(s)