famefables
Elite
Python:
import requests
import smtplib
from email.mime.text import MIMEText
from time import sleep
# Email setup
def send_email_notification():
sender = 'your-email@gmail.com'
receiver = 'receiver-email@gmail.com'
subject = 'Registration Available'
body = 'The registration for Hotel 101 is now available!'
msg = MIMEText(body)
msg['Subject'] = subject
msg['From'] = sender
msg['To'] = receiver
with smtplib.SMTP('smtp.gmail.com', 587) as server:
server.starttls()
server.login('your-email@gmail.com', 'your-email-password')
server.sendmail(sender, receiver, msg.as_string())
# API URL and request
api_url = "https://hotel101app.com/api/auth/login"
def check_registration():
response = requests.get(api_url)
if response.status_code == 200: # You may need to adjust this based on API response
print("API reachable, checking registration availability...")
# Assuming an available registration returns a specific status or message
if "registration open" in response.text.lower():
send_email_notification()
print("Notification sent: Registration available!")
else:
print("Registration not available yet.")
else:
print(f"Error: API returned status code {response.status_code}")
# Loop to check every 60 seconds
while True:
check_registration()
sleep(60) # Check every 60 seconds
ito code kaso di ko alam paano to haha