This program is meant to send an email at a certain time to each client with the yesterday scores and/or today's schedule for preferred NBA teams, and/or weather forecast for the day for preferred zip codes. To schedule this to run everyday automatically, follow the instructions for setting up the program with task manager.
- Go to https://www.python.org/downloads/ and click the button that says "Download Python"
- Click on the exe installer for Python and if there is a box that says something about adding to PATH, check it, allow permission to override path length at the end of the click through and skip to step 4. Click through to continue and make sure you know where it is downloaded to
- Click through to continue and make sure you copy the path where it is downloaded to
- Set the path by following the instructions for whichever system you use: Windows - https://www.tutorialspoint.com/How-to-set-python-environment-variable-PYTHONPATH-on-Windows#:~:text=Set%20PYTHONPATH%20using%20Command%20Prompt&text=Click%20on%20the%20%22Environment%20Variables,to%20save%20the%20environment%20variable. Linux - https://www.tutorialspoint.com/How-to-set-python-environment-variable-PYTHONPATH-on-Linux#:~:text=By%20setting%20the%20PYTHONPATH%20environment,of%20the%20default%20search%20paths. Mac - https://www.educative.io/answers/how-to-add-python-to-the-path-variable-in-mac
This step is essential for getting the program to run everyday at a certain time. (I will write out how to do this for Windows, but for Mac and Linux, if you do not know how to schedule a program to run everyday, you will have to look up how or try it yourself based on what I present here and intuition). *Note: The computer you set this up on, must be on at the time or some point afterward to be able to automatically send emails.
- Go to Task Scheduler or search up "Task Scheduler" in you Application/Start search bar
- Click on the "Task Scheduler Library" tab on the left
- Click "Create Task" on the right side
- Name the task something that you would be able to remember or spot easily as the automated email task (i.e. "Daily Email Report")
- Decide whether you want the program to run whether the user is logged on or not or only when user is logged on (if you can't decide just leave it as the default option)
- Click on the "Triggers" tab and click "New..."
- Make sure that next to "Begin the task:", it says "On a schedule"
- Pick the start date and start time (click "Synchronize across time zones" if you would like)
- Click the bubble next to "Daily" and make sure that "1" is in the blank for "Recur every: _ days"
- Click "OK" and click on the "Actions" tab
- Click "New..." and make sure next to "Action:" it says "Start a program"
- Under "Program/script" paste the path that you copied when setting up Python
- In the box to the right of "Add arguments (optional):" type "gui.py"
- In the box to the right of "Start in (optional):" paste the path of the folder you downloaded the project to
It is necessary to follow these steps to create a bot gmail account and an app password for the account so that the program can log in without error.
- Create a gmail address that you want to send the daily emails
- Click on the Google profile picture and click "Manage your Google Account"
- Click on the "Security" tab on the left and click on "2-Step Verification" under "How you sign in to Google"
- Go through the setup
- When you are done, go back into 2-Step Verification if you are not already there, scroll down, and click on "App passwords"
- Click on "Select app" and click "Mail"
- Click on "Select device" and click the device that matches what you will run this program on or "Other (Custom name)" if you do not see your device
- Copy the app password that appears in the colored box and go to the keys_and_passwords.py where you have the project downloaded to
- Paste the app password into the quotation marks next to "password"
- Type in or paste the email address of the new account into the quotation marks next to "emailAddr" in the same file
This step is necessary for being able to access weather forecast information.
- Go to https://home.openweathermap.org/users/sign_up if you do not have an account with OpenWeather API, otherwise if you already have an account skip to step 3
- Do the necessary verification to create your account (when asked about company and purpose, skip the company entry and select other for purpose, then verify the email)
- Sign in
- Click on your username (or partial username) in the top right corner of the page
- Click "My API Keys" and copy the key under "Key"
- Go to the keys_and_passwords.py file where you downloaded the project and paste the key in the quotation marks next to apiKey
- On the github page, click the green button that says "Code" and then "Download zip"
- Find the zip file, right click on it, extract it to a desired folder, and copy the full path of the extracted folder (should look something like "C:.../desired_folder/Appropriate-Song-Separator")
- Open up the terminal/command prompt
- Change the directory to the folder that was extracted by typing "cd" and pasting the path you copied earlier (CTRL + SHIFT + V) and pressing Enter
- Type or paste "py -3 -m venv .venv" and press Enter (after you do this once for the project you won't have to do it again)
- Type or paste ".venv/scripts/activate" (This step and step 11 will have to be done everytime you open up a new terminal to run a program that has installed a virtual environement by doing step 8)
- Type or paste "pip install -r requirements.txt" and press Enter
- To run the program, type "python gui.py" and press Enter
- Enter the appropriate information and pay attention to the text box at the bottom for info about the program's run. If you see a YouTube or Spotify link pop in the text box, there might also be a website that pops up on your browser. Make sure these links match or at least make sure the links are Spotify or YouTube links and allow all permissions.
Instead of using the GUI to make small changes to the wanbarConfig.json file which the program looks at to decide who to email what, if you know the format of the file, you can make small changes yourself. (Bool=True or False value)
{ emailAddress: [ [ userWantsNBAScoresBool, userWantsNBAScheduleBool, userWantsWeatherForecastBool ], [ '76ers','Bucks','Bulls','Cavaliers','Celtics','Clippers','Grizzlies','Hawks','Heat','Hornets','Jazz','Kings','Knicks','Lakers', 'Magic','Mavericks','Nets','Nuggets','Pacers','Pelicans','Pistons','Raptors','Rockets','Spurs','Suns','Thunder','Timberwolves','Trail Blazers','Warriors','Wizards (These are just to show how to enter the team names, i.e. must enter 76ers not Sixers for the Philly team)' ], [ 0 for imperial, 1 for metric, or 2 for standard (can only choose one for each user), [ 'zipcode' ] ]
],
emailAddress2:...
}
HTML formatted emails for a more aesthetically pleasing email Include different sports leagues