Capstone project day – Flash Cards (using tkinter) for learning most frequently used words in any language.
Built app GUI without walkthrough guide.
Used Pandas to convert csv of French -> English translations
Added logic to show target language for 3 seconds before flipping card to show English.
Used Pandas again to establish a CSV of unlearned words.
Used Try / Except to use the saved user words-to-learn list (if it exists). If the file doesn’t exist, a new file is established using all possible words-to-learn.
Introduced to smtplib module for Python.
Setup dummy accounts as sender / recipient.
Used Python to send email over SMTP (including StartTLS)
Learned how to import modules with aliases (e.g. import datetime as dt)
Introduced to datetime module
Discovered pythonanywhere, a service that hosts, schedules and executes Python apps in the cloud.
Quote of the Day Emailer – On a given weekday, the application will send a random motivational quote. The datetime module checks the day to see if the rest of the code should be triggered. The quote is pulled from a text file full of quotes. Smtplib builds and sends the message
Birthday Emailer – Every day, the app checks a contacts list CSV to determine if any of them have a birthday today. If so, the user is added to the queue. The app then grabs a random birthday template email and uses mail-merge logic to substitute in the birthday celebrater’s name. Finally, the app uses smtplib to send the email.
Introduced Application Programming Interface – In today’s lesson, it will be a method of having our application interact with an external data source
API is a “menu” of items that you can extract from the data source (like a kitchen).
API endpoint is typically a URL that is used for interacting with the API
API GET requests are often returned as JSON objects. These return as minimally formatted data packages.
Made first API request for the ISS’s current location and received response code 200.
404 – Doesn’t exist.
1xx – Not final, processing still occurring
2xx – Success
3xx – Permission error
4xx – You (the user) screwed up
5xx – I (the server) screwed up
Reviewed raising exceptions for API calls.
Reviewed extracting JSON from API calls and pulling dictionary data from the JSON
Interacted with Kanye West quote API to pull random Kanye quotes.
Interacted with Sunrise / Sunset API to determine when the sun will set and rise at a given Latitude / Longitude.
ISS Sky Checker – The app checks every seconds to determine if the sky is dark and if the present position of the ISS is within 5 degrees (lat and lng) of my position. If both requirements are met, an email is sent to me to tell me to run outside and look for the ISS. The first API used were a sunrise / sunset API that lets me know when the sun will rise and set at my coordinates to determine if it is presently dark. The second API reported the current coordinates of the ISS.
Reviewed project of the day – an update to the Day 17 quiz app, which will now include a GUI and use API requests to pull questions from the Trivia API.
Learned about HTML entities and how to “unescape” them.
Created Quizzler app GUI.
Added UI class to manage the app UI using Tkinter.
Learned how to pass entire objects as arguments.
Learned how to declare datatypes to reduce errors in code.
Made UI more responsive to user actions to improve the experience.
This project was much more of a walkthrough than a challenge, many new things were introduced, but most of the solution was directly dictated.
I think I’ll look back at this project as a key building block because of the complex concepts that were introduced, but there isn’t much of an “I made this” feeling due to the amount of handholding.
API Authentication introduced.
APIs with valuable data (or maintenance-demanding data) tend to charge for usage.
API providers track your usage through an API key (essentially a username / password)