-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
22 lines (22 loc) · 1.03 KB
/
Copy pathscript.py
File metadata and controls
22 lines (22 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import requests as req
from bs4 import BeautifulSoup
headers = {
'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36'
}
try:
response = req.get("https://istheservicedown.in/problems/valorant", headers=headers)
response.raise_for_status()
soup = BeautifulSoup(response.content, 'html.parser')
valorant_status = soup.find('p', class_ = "status-title-normal")
if valorant_status.text.strip().lower() == "no problems detected":
print("VALORANT servers are working fine!")
else:
print("There might be issues with VALORANT servers at the moment.\nTry again later.")
except req.exceptions.ConnectionError:
print("No internet connection detected.\nPlease check your connection and try again.")
except req.exceptions.HTTPError:
print("HTTP error occurred.")
except AttributeError:
print("Failed to retrieve the server status.\nTry again later.")
except Exception as err:
print(f"An unexpected error has occurred: {err}")