Example #1
0
 def onBoth(self):
     sleep(1)
     updateOrderNumber()
     updateJobStat()
     textmyself.textmyself('The order details report for ' + name[44:49] +
                           ' has been completed, Michael.')
     sys.exit()
Example #2
0
def checkWfaClear1():
    if pixelMatch(checkWfa1[0],checkWfa1[1],checkWfa1[2],checkWfa1[3],checkWfa1[4]) or pixelMatch(checkWfa2[0],checkWfa2[1],checkWfa2[2],checkWfa2[3],checkWfa2[4]) \
       or pixelMatch(checkWfa3[0],checkWfa3[1],checkWfa3[2],checkWfa3[3],checkWfa3[4]):
        time.sleep(2)
        pyautogui.press('f8')
        time.sleep(2)
        pyautogui.press('f8')
        if pixelMatch(checkWfa1[0],checkWfa1[1],checkWfa1[2],checkWfa1[3],checkWfa1[4]) or pixelMatch(checkWfa2[0],checkWfa2[1],checkWfa2[2],checkWfa2[3],checkWfa2[4]) \
          or pixelMatch(checkWfa3[0],checkWfa3[1],checkWfa3[2],checkWfa3[3],checkWfa3[4]):
            textmyself.textmyself('Clear WFA')
            pyautogui.confirm('Clear WFA!!')
Example #3
0
def parseFacultyPage(br, facultyID):
    if br is None:
        return None

    br.open('https://vtop.vit.ac.in/student/stud_home.asp')
    response = br.open('https://vtop.vit.ac.in/student/class_message_view.asp?sem=' + facultyID)
    html = response.read()
    soup = BeautifulSoup(html)
    tables = soup.findAll('table')

    # Extracting basic information of the faculty
    infoTable = tables[0].findAll('tr')
    name = infoTable[2].findAll('td')[0].text
    if (len(name) is 0):
        return None
    subject = infoTable[2].findAll('td')[1].text
    msg = infoTable[2].findAll('td')[2].text
    sent = infoTable[2].findAll('td')[3].text
    emailmsg = 'Subject: New VIT Email' + msg

    with open('output/WS.json') as data_file:
        data = json.load(data_file)
    if data["date"] == sent or data['message'] == msg:
        outputpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'output')
        if os.path.isdir(outputpath) is False:
         os.makedirs(outputpath)
        result = {'name': name, 'subject': subject, 'message': msg, 'date': sent}
        with open('output/' + str(facultyID) + '.json', 'w') as outfile:
          json.dump(result, outfile, indent=4)
        print('email already sent')
        return result

    else:
        outputpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'output')
        if os.path.isdir(outputpath) is False:
         os.makedirs(outputpath)
        result = {'name': name, 'subject': subject, 'message': msg, 'date': sent}
        with open('output/' + str(facultyID) + '.json', 'w') as outfile:
          json.dump(result, outfile, indent=4)
        you = "*****@*****.**"
        me = "*****@*****.**"
        s = smtplib.SMTP('smtp.gmail.com', 587)
        s.ehlo()
        s.starttls()
        s.login('*****@*****.**','rahulkapoor23')
        s.sendmail(me, you, emailmsg)
        s.quit()
        print('sent email and text message')
        textmyself.textmyself(msg)
        return result
Example #4
0

def makeBank(url, htmlClass):
    page = requests.get(url)
    page.raise_for_status()
    pageSoup = bs4.BeautifulSoup(page.text, "html.parser")
    elems = pageSoup.select('.' + htmlClass)
    return elems


updated = False
tags = makeBank(
    'http://www.realclearpolitics.com/epolls/2016/president/us/general_election_trump_vs_clinton-5491.html',
    'dem')
avg = tags[0].getText()
print('Current matchup is: ' + avg)

while not updated:
    newTags = makeBank(
        'http://www.realclearpolitics.com/epolls/2016/president/us/general_election_trump_vs_clinton-5491.html',
        'dem')
    curAvg = newTags[0].getText()
    if avg != curAvg:
        toText = "NEW POLL:\nPrevious H2H matchup was " + avg + "\nNew H2H matchup is " + curAvg
        textmyself.textmyself(toText)
        webbrowser.open('https://www.predictit.org/')
        webbrowser.open(
            'http://www.realclearpolitics.com/epolls/2016/president/us/general_election_trump_vs_clinton-5491.html'
        )
        updated = True
    time.sleep(5)
Example #5
0
import textmyself

textmyself.textmyself('The boring task is finished.')
Example #6
0
 def onJobStat(self):
     sleep(1)
     updateJobStat()
     textmyself.textmyself('Updating job stat for ' + name[44:49] +
                           ' has been completed, Michael.')
     sys.exit()
Example #7
0
 def onOrder(self):
     sleep(1)
     updateOrderNumber()
     textmyself.textmyself('Updating order number for ' + name[44:49] +
                           ' has been completed, Michael.')
     sys.exit()
Example #8
0
def excelLoop1():
    wb = load_workbook(filename=name)
    wb.get_sheet_names()
    ws = wb.get_sheet_by_name('Report Data')
    global eRow
    global maxRow
    maxRow = ws.max_row - 2
    checkApptSched()
    for i in range(ws.max_row - 2):
        global skipOrder
        global orderCancelled
        global arnError
        global aNF
        skipOrder = False
        orderCancelled = False
        arnError = False
        aNF = False
        getSearchBox()
        try:
            type2(ws.cell(row=eRow, column=7).value)
        except TypeError:
            textmyself.textmyself('Blank ARN - Break')
            break
        clickSearchButton()
        sleep(.2)
        checkArnErrorOrCancel()
        appNotFound()
        if arnError == True:
            ws.cell(row=eRow, column=8).value = 'ARN Error'
            eRow += 1
            continue
        if orderCancelled == True:
            ws.cell(row=eRow, column=8).value = 'Cancelled'
            eRow += 1
            while True:
                try:
                    wb.save(jStatFileName)
                    break
                except PermissionError:
                    exceptPermissionError()
            continue
        if aNF == True:
            ws.cell(row=eRow, column=8).value = 'Appointment not found'
            skipOrder = True
        if skipOrder == True:
            eRow += 1
            continue
        waitLoad2()
        if skipOrder == True:
            ieRefresh()
            try:
                type2(ws.cell(row=eRow, column=7).value)
            except TypeError:
                textmyself.textmyself('Blank ARN - Break')
                break
            waitLoad2()
            if skipOrder == True:
                ws.cell(row=eRow, column=8).value = 'did not load'
                eRow += 1
                continue
        highlightOrderNumber()
        copy()
        ws.cell(row=eRow, column=10).value = pyperclip.paste()
        eRow += 1
        while True:
            try:
                wb.save(jStatFileName)
                break
            except PermissionError:
                exceptPermissionError()
#! python3
# -*- coding: utf-8 -*-

# 演習プロジェクト 16.9.2
# OpenWeatherMap.org から天気情報を取得し、雨ならSMSで通知する。

import json, requests
import textmyself

LOCATION = 'Sapporo'  # 場所を設定してください
APPID = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'  # openweathermap のAPIキーを設定してください

# 天気のデータを取得する
url = 'http://api.openweathermap.org/data/2.5/forecast/daily?q={}&cnt=3&appid={}'.format(
    LOCATION, APPID)
response = requests.get(url)
response.raise_for_status()

weather_data = json.loads(response.text)
w = weather_data['list']
weather = w[0]['weather'][0]['main']
print(weather)

if weather == 'Rain':
    textmyself.textmyself('今日は雨です。')
Example #10
0
#accepts URL and class, returns list of Tag objects under that class
def makeBank(url, htmlClass):
    page = requests.get(url)
    page.raise_for_status()
    pageSoup = bs4.BeautifulSoup(page.text, "html.parser")
    elems = pageSoup.select('.' + htmlClass)
    return elems


updated = False
tags = makeBank('http://www.politifact.com/personalities/donald-trump/',
                'chartlist__count')
numPOF = tags[5].getText()
numPOF = numPOF[:2]
print('Current number of POF is: ' + numPOF)

while not updated:
    newTags = makeBank('http://www.politifact.com/personalities/donald-trump/',
                       'chartlist__count')
    newNumPOF = newTags[5].getText()
    newNumPOF = newNumPOF[:2]
    if newNumPOF != numPOF:
        textmyself.textmyself("POF FOUND YO")
        webbrowser.open(
            'https://www.predictit.org/Market/2427/How-many-totally-false-statements-will-Trump-make-in-September'
        )
        webbrowser.open(
            'http://www.politifact.com/personalities/donald-trump/')
        updated = True
    time.sleep(5)
#! python3 
# This program checks whether it is raining. If it is, then it will text me
# a reminder to bring an umbrella before leaving the house 

import textmyself, requests, json

apiId = input("Enter your openweather API id:")

# requesting openWeatherMap API url & checking for error
url = "http://api.openweathermap.org/data/2.5/weather?q={}&appid={}".format('singapore', apiId)
response = requests.get(url)
response.raise_for_status()

# Converting json to python values 
jsonWeatherData = response.text
weatherData = json.loads(jsonWeatherData)

# Accessing rain information
weather = weatherData['weather'][0]['main']
print(weather)

# Send text message if it is raining today
if weather == 'Rain':
    print("It is raining today. Sent text message to you.")
    textmyself.textmyself("It is raining today. Remember to bring an umbrella when you go out.")
else: 
    print("It is not raining today.")    
def checkForRain():
    w = getWeather()
    if w[0]['weather'][0]['main'] == 'Rain':
        textmyself.textmyself('Bring an umbrella, Giorgio. Rain is due today!')
Example #13
0
    #puts(colored.magenta("Start Date: ") + planDetails[2])
    #puts(colored.magenta("End Date: ") + planDetails[3])
    #print "-" * 40

    #print "-" * 40
    #puts(colored.cyan(" " * 17 + "Usage"))
    #print "-" * 40
    #puts(colored.magenta("Total Time: ") + tds[1].text)
    #puts(colored.magenta("Uploaded: ") + tds[2].text)
    #puts(colored.magenta("Downloaded: ") + tds[3].text)
    #puts(colored.magenta("Total Data: ") + tds[4].text)
    sd = str(tds[4].text)
    # print(float(filter(str.isdigit, sd)))
    x = map(float, re.findall(r'[+-]?[0-9.]+', sd))

    textmyself.textmyself("Hey! Rahul you have used " + sd)

    print "-" * 40


if __name__ == '__main__':
    print "-" * 40
    puts(colored.white(" " * 15 + "ProntoUsage"))
    print "-" * 40
    debug = False
    args = Args().grouped
    if '--debug' in args.keys():
        debug = True
    if '--delete' in args.keys():
        try:
            os.remove('cred.json')
Example #14
0
sense = SenseHat()
sense.clear()


temp = sense.get_temperature() * 9/5 + 32
hum = sense.get_temperature_from_humidity() * 9/5 + 32
pre = sense.get_temperature_from_pressure() * 9/5 + 32
print("The three temps are {}, {}, {}" .format(temp, hum, pre))
print('')
sense.clear()
humidity = sense.get_humidity() 
print("The humidity is {}" .format(humidity))
print('')
sense.clear()
pressure = sense.get_pressure()
print("The pressure is {}" .format(pressure))

# Output results to a txt file to reference later

time = strftime("%c")
stuff = open('temps.txt', 'a')
stuff.write('Time and date at recording: {}\r\n' .format(time))
stuff.write('	Tempeture readings are: {}, {}, {} \r\n' .format(temp, hum, pre))
stuff.write('	Humidity is: {} \r\n' .format(humidity))
stuff.write('	Pressure is: {} \r\n' .format(pressure))
stuff.write('\r\n \r\n')
#stuff.write('Date and time of record: \n' + time + '\n')
stuff.close()

textmyself.textmyself('The current temp in your apartment is {:.1f}, humidity is {:.3f}, pressure is {:.4f}' .format(temp, humidity, pressure))
Example #15
0
    currentDateFull = str(datetime.datetime.now())
    currentDateDay = currentDateFull.split(" ")
    timesToReport = ['08:00:00', '11:00:00', '14:00:00', '17:00:00']
    if currentDateDay[0] == localDateDay and localDateTime in timesToReport:
        # isolate the hour from military time.
        splitLocalDateTime = localDateTime.split(":")
        hour = splitLocalDateTime[0]
        # get rid of leading zeros
        if hour[0] == '0':
            earlyAmHour = hour[1]
            textMessage += str(" " + earlyAmHour + 'am' + ': ' +
                               str(s[date]['swell']['minBreakingHeight']) +
                               "-" +
                               str(s[date]['swell']['maxBreakingHeight']) +
                               ' feet\n')
        elif int(hour) > 12:
            pmHour = int(hour) - 12
            textMessage += str(" " + str(pmHour) + 'pm' + ': ' +
                               str(s[date]['swell']['minBreakingHeight']) +
                               "-" +
                               str(s[date]['swell']['maxBreakingHeight']) +
                               ' feet\n')
        else:
            textMessage += str(hour + 'am' + ': ' +
                               str(s[date]['swell']['minBreakingHeight']) +
                               "-" +
                               str(s[date]['swell']['maxBreakingHeight']) +
                               ' feet\n')

textmyself.textmyself(textMessage)