Last active
July 6, 2017 14:55
-
-
Save feocco/42d3e0668d545d1f5dc4227c4917187d to your computer and use it in GitHub Desktop.
Quick script to schedule SMS and remind friends to keep practicing coding. First iteration, only checks codecademy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from twilio.rest import Client | |
page = requests.get('https://www.codecademy.com/profileName') | |
# Twilio Data | |
twilioNum = '+11234563667' | |
twilioSID = 'SID_HERE' | |
twilioToken = 'TOKEN_HERE' | |
chrisNum = '+11234563667' | |
# Pull number of days | |
search = u'Last coded' | |
pos = page.text.find(search) | |
phrase = page.text[pos:pos + 16] | |
days = phrase.split()[2] | |
def sendText(): | |
client = Client(twilioSID, twilioToken) | |
message = client.api.account.messages.create( | |
to= chrisNum, | |
from_= twilioNum, | |
body= bodyText) | |
if int(days) > 1: | |
bodyText = "You haven't coded on Codecademy in {0} days, you shitter. Get to work.".format(days) | |
else: | |
bodyText = "Good job coding! Keep up the good work man." | |
sendText() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment