Initial commit: Resensys site status app
This commit is contained in:
39
checkAllSites.py
Normal file
39
checkAllSites.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import mysql.connector.python
|
||||
import requests
|
||||
|
||||
# The Lambda endpoint
|
||||
URL = "https://7ft6zzxgc3fr34nmrd5t63cel40vzvhp.lambda-url.us-east-1.on.aws/"
|
||||
|
||||
# List of site IDs to check
|
||||
site_ids = [
|
||||
"48-01",
|
||||
"48-02",
|
||||
"48-03",
|
||||
# add more here...
|
||||
]
|
||||
|
||||
# Common headers
|
||||
HEADERS = {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
MYSQL_USER = "MKK"
|
||||
MYSQL_PW = "BoxPaxMint12"
|
||||
MYSQL_HOST = "resensys-cloudbase.coxrusc9yue4.us-east-1.rds.amazonaws.com"
|
||||
MYSQL_PORT = 3306
|
||||
|
||||
def get_sites():
|
||||
|
||||
print("This is where we get the site IDs...")
|
||||
|
||||
if __name__ == "__main__":
|
||||
for site_id in site_ids:
|
||||
payload = {"site_id": site_id}
|
||||
try:
|
||||
response = requests.post(URL, headers=HEADERS, json=payload, timeout=10)
|
||||
response.raise_for_status() # raises for 4xx/5xx
|
||||
print(f"[{site_id}] OK: {response.json()}")
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"[{site_id}] ERROR: {e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user