-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-tesla.py
More file actions
executable file
·39 lines (32 loc) · 1011 Bytes
/
check-tesla.py
File metadata and controls
executable file
·39 lines (32 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import requests
from bs4 import BeautifulSoup
import time
from twilio.rest import Client
# Twilio credentials and setup
account_sid = 'ENTER'
auth_token = 'ENTER'
twilio_client = Client(account_sid, auth_token)
twilio_phone_number = 'ENTER'
your_phone_number = 'ENTER'
def get_page_content(url):
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
return soup
def send_sms(message):
message = twilio_client.messages.create(
from_=twilio_phone_number,
body=message,
to=your_phone_number
)
print(f"Message sent: {message.sid}")
def main():
url = 'https://www.tesla.com/en_US/teslaaccount/order/RN11286NNNN'
initial_content = get_page_content(url)
while True:
time.sleep(3600) # 1 hour
current_content = get_page_content(url)
if current_content != initial_content:
send_sms("Web page has changed!")
initial_content = current_content
if __name__ == "__main__":
main()