Email contains
- Today's weather and temperature
- Joke of the day
- Quote of the day
- more?
- Create a virtual environment with Python 3.8 and activate it
pip install -r requirements.txt
- Create a copy of
.env-sample
and rename it to.env
- Update values in
.env
for your email/password and coordinates- Put data in this file that you don't want to make public. Don't commit it to git.
python daily_email/main.py {your_name}
- From the homepage, go to Consoles and open a new Bash Console
- In the terminal, clone this repository
git clone <repo_url>
- Navigate into the project folder
cd daily_email_project
- Install the requirements
pip3.8 install --user -r requirements.txt
- You must use the
--user
flag to install your own modules in PythonAnywhere
- You must use the
- From the homepage, go to the Files
- Open up the
daily_email_project
directory - Open the
.env-sample
file - Click Save as... and rename to
.env
- Fill in your info and save
- From the homepage, go to Tasks
- Create a new task with details:
- Frequency: Daily
- Time: Current server time + 1 minute
- Command: python3.8 /home/<your_username>/daily_email_project/daily_email/main.py
- Description: Daily email
- Save the task
- See the console logs for print messages or errors
- Once errors are resolved, set the task time for the morning and you're done!
smtplib.SMTPAuthenticationError: Please log in via your web browser and then try again. Learn more at https://support.google.com/mail/answer/78754
You must create a Google app password to log into your Gmail account.
- Turn on 2-Step verification
- Create an app password
- Use that password as the
GMAIL_PASSWORD
in your.env
file
requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.jokes.one', port=443): Max retries exceeded with url: /jod (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))
The API you are requesting isn't on Python Anywhere's list of allowed URLs.
To request that your API be added to the list of allowed URLs:
- Send a message through the "Send feedback" button in the header
- Send an email to info@pythonanywhere.com
Make sure to include:
- a link to the API documentation. Particularly to documentation that states the domain where the API is published.
- the domain or domains (including subdomains) that the API is served from.
You will probably want to wrap each API call in a try
block
so that successful calls get sent in an email and unsuccessful ones get printed to the console.
This project has no license. See the LICENSE file for more details.
You can choose a license from https://choosealicense.com/. Replace contents of LICENSE with the license content.