import urllib.request from pathlib import Path url = "http://83.147.38.107/hotspot/otantik-hub-nkoabang/login.html" req = urllib.request.Request(url, headers={"User-Agent": "wo-check"}) with urllib.request.urlopen(req, timeout=30) as r: data = r.read() text = data.decode("utf-8", "replace") out = Path(r"c:\laragon\www\light-otantik-nux\scripts\_tmp_nko_login_vps.html") out.write_bytes(data) print("len", len(data)) print("woHotspotLite", "woHotspotLite" in text) print("href=wo.css", 'href="wo.css"' in text) print("portal.otantik.cm", "portal.otantik.cm" in text) print("ui/ui_custom", "ui/ui_custom" in text) print("slide-1.jpg", "slide-1.jpg" in text) print("bundle.jpg", "bundle.jpg" in text)