Пример #1
0
def main():
    print("\nWelcome to Circus Emailer App!\n")
    visitors = get_visitors()
    schedule = get_schedule()
    forecast = weather.get_weather_forecast(CIRCUS_LOCATION)
    emailer.send_emails(visitors, schedule, forecast)
    print("\nThank you for using this App. Bye!\n\n")
Пример #2
0
def main():
	emails = mailer.get_emails()
	#print(emails)
	schedule = get_schedule()
	#print(schedule)
	forecast = weather.get_weather_forecast()
	#print(forecast)
	mailer.send_emails(emails, schedule, forecast)
Пример #3
0
def main():
    emails = get_emails()
    
    schedule = get_schedule()
    
    forecast = weather.get_weather_forecast()
    
    mailer.send_emails(emails, schedule, forecast)
Пример #4
0
def main():
    emails = get_emails()
    forecast = weather.get_weather_forecast()
    self_email = input('Please input your email address:')
    password = input('Please input your password:')

    for email,name in emails.items():
        mailer.send_email(self_email, password, email, name, forecast)
Пример #5
0
def main():
    emails_list = get_emails()
    print(emails_list)
    schedules = get_schedule()
    print(schedules)
    forecast = weather.get_weather_forecast()
    print(forecast)
    mailer.send_emails(emails_list, schedules, forecast)
Пример #6
0
def main():
    emails = get_emails()

    schedule = get_schedule()

    forecast = weather.get_weather_forecast()

    mailer.send_emails(emails, schedule, forecast)
Пример #7
0
def main():
    emails = get_emails()
    print(emails)
    
    forecast = weather.get_weather_forecast()
    print(forecast)

    mailer.send_emails(emails,forecast)
Пример #8
0
def setup_scheduler():
    logger.info("Starting modem task")
    schedule.every().second.do(get_modem_data)
    logger.info("Setting up sensors")
    init_sensors()
    logger.info("Starting sensor task")
    schedule.every().second.do(get_sensor_data)
    """
    logger.info("Starting bme280 task")
    schedule.every().second.do(get_bme280_data)
    logger.info("Starting tsl2561 task")
    schedule.every().second.do(get_tsl2561_data)
    logger.info("Starting lis3dh task")
    schedule.every().second.do(get_lis3dh_data)
    logger.info("Starting gps task")
    schedule.every().second.do(get_gps_data)
    """
    logger.info("Starting relay data task")
    schedule.every().second.do(get_relay_data)
    logger.info("Starting relay auto timeout task")
    schedule.every().second.do(relay_auto_timeout)
    logger.info("Starting relay reminder timeout task")
    schedule.every().second.do(relay_reminder_timeout)
    logger.info("Starting connection checker task")
    schedule.every(5).seconds.do(connection_checker)
    logger.info("Starting battery voltage checker task")
    schedule.every(5).seconds.do(check_batt_voltage)
    logger.info("Starting load state checker task")
    schedule.every(5).seconds.do(check_load_state)
    logger.info("Starting river checking task")
    init_river()
    schedule.every(5).minutes.do(check_river)
    logger.info("Starting sun data tasks")
    schedule.every().day.at('00:00').do(get_new_sun_data)
    get_new_sun_data()
    schedule.every().second.do(update_sun_data)
    logger.info("Starting weather forecast task")
    get_weather_forecast()
    schedule.every(15).minutes.do(get_weather_forecast)
    logger.info("Starting PIco UPS data task")
    setup_ups()
    schedule.every().second.do(get_ups_data)
    logger.info("All tasks scheduled!")
    pass
Пример #9
0
def process_weather_data():
    gmail = create_gmail_service()
    user_data = get_user_data(gmail)
    for data in user_data:
        print(data)
        lat, log = data['lat'], data['long']
        print(lat, log)
        forecast = get_weather_forecast(lat, log)
        print(forecast)
        location = reverse_geocode(lat, log)
        send_weather_data(data['sender_id'], location, forecast)
Пример #10
0
def main():
    emails = get_emails()

    message = get_message()

    forecast = weather.get_weather_forecast()

    mailer.send_emails(emails, message, forecast)

    print(Back.GREEN + Fore.WHITE + ' Done!!! ' + Fore.RESET + Back.RESET +
          '\n')
Пример #11
0
def main():
    # Get our dictionary of customer emails and names
    emails = get_emails()

    # Get our daily performance schedule
    schedule = get_schedule()

    # Get the current weather forecast
    forecast = weather.get_weather_forecast()

    # Send emails to all of our customers with our forecast and schedule
    smtp.send_emails(emails, schedule, forecast)
Пример #12
0
def main():
    emails = get_emails()

    schedule = get_schedule()

    # need to add weather. to let it know to use the weather module
    # containing the weather function
    forecast = weather.get_weather_forecast()

    # need to add mailer. to let it know to use the mailer module
    # containing the mailer function
    mailer.send_emails(emails, schedule, forecast)
Пример #13
0
def main():

    # introduce our variables from our modules
    emails = email_handler.get_emails()
    schedule = schedules.get_schedule()
    forecast = weather.get_weather_forecast()

    # send the emails with schedule and forecast included.
    try:
        email_handler.send_emails(emails, schedule, forecast)

        print(str(len(emails)) + ' Emails were sent!')
    except:
        print('Something went wrong. Emails did not send.')
Пример #14
0
def weather_forecast(update: Update, context: CallbackContext) -> int:
    user_data = context.user_data
    if ('city' not in user_data.keys()) or (not user_data['city']):
        update.message.reply_text(
            "Set up a default city first by clicking on the Setup default city button",
            reply_markup=markup,
        )
    else:
        update.message.reply_text(
            "Getting a weather forecast"
        )
        forecast = get_weather_forecast(user_data['city'])
        update.message.reply_text(forecast, reply_markup=markup)
    return CHOOSING
Пример #15
0
    def test_weather(self):
        mock = MagicMock()
        requests.get = mock
        mock().json = MagicMock(return_value=self.expected_output)

        actual_response = get_weather_forecast()

        requests.get.assert_called_with(
            "http://api.openweathermap.org/data/2.5/weather"
            "?q=Gurgaon&units=metric&appid=5541fee053ab030b29d83cd944afe230")

        expected_response = 'The weather forcast for today is smoke, with an average of around 17, with 17 being the highest and 17 being the lowest'

        self.assertEqual(actual_response, expected_response)
Пример #16
0
import smtplib
from email.mime.text import MIMEText
import weather
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText

forecast = weather.get_weather_forecast()

msg = MIMEMultipart()
my_email = "MY EMAIL"
pwd = "PWD"

msg['Subject'] = 'BUENOS DIAS'
body = """
CLASSES TODAY
http://chaturangafitness.com/apps/mindbody/list-schedule

""" + forecast

msg.attach(MIMEText(body, 'plain'))

server = smtplib.SMTP("smtp.live.com", 587)
server.ehlo()
server.starttls()
server.ehlo()
server.login(my_email, pwd)

server.sendmail(my_email, my_email, msg.as_string())
server.quit()
Пример #17
0
def main():
    schedules = schedule.get_schedule()
    emails = mails.get_emails()
    forecast = weather.get_weather_forecast()
    mails.send_emails(emails, schedules, forecast)
Пример #18
0
def main():
    # Get our dictionary of customer emails and names
    emails = get_emails()
    forecast=weather.get_weather_forecast()
    mailer.send_emails(emails,forecast)
Пример #19
0
def main():
    emails = get_emails()
    message = get_message()
    forecast = weather.get_weather_forecast()

    mailer.send_emails(emails, message, forecast)