Skip to content

Commit 862f46d

Browse files
committed
clearing clutter
1 parent a161cdc commit 862f46d

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

monitor/checks.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,13 @@
11
import os
22
import requests
33
import logging
4-
from urllib.parse import urlparse
5-
6-
ALLOW_403_FOR = {
7-
d.strip().lower()
8-
for d in os.getenv("ALLOW_403_FOR", "").split(",")
9-
if d.strip()
10-
}
114

125
def check_url(url: str, timeout: int = 10) -> dict:
136
"""Return dict with url, status, status_code, error."""
147
try:
158
r = requests.get(url, timeout=timeout)
16-
host = urlparse(url).hostname or ""
17-
host = host.lower()
18-
19-
print(f"URL: {url}, host: {host}, ALLOW_403_FOR: {ALLOW_403_FOR}")
20-
219
if r.status_code == 200:
2210
return {"url": url, "status": "Success", "status_code": 200, "error": None}
23-
24-
if r.status_code == 403:
25-
print("🔥🔥🔥 inside 403 block", host)
26-
if host.endswith("substack.com") or host == "substack.com":
27-
print("✅ Substack override triggered")
28-
return {
29-
"url": url,
30-
"status": "Success (403 allowed)",
31-
"status_code": 403,
32-
"error": None
33-
}
34-
3511
return {
3612
"url": url,
3713
"status": f"HTTP {r.status_code}",

0 commit comments

Comments
 (0)