-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Another gorgeous set of notes. 🦄👍 (Apologies if any of my comments don't make perfect sense or are poorly worded - it's a bit late and I'm starting to get tired as I'm writing these).
- Line 5: Might be worth a quick explanation of why we need to install this one via pip (as this is the first pip-installed library they will have seen) while the others can just be imported normally.
- Line 29: "That's right!" doesn't seem to fit since there wasn't a question posed immediately prior. Perhaps just omit the exclamation.
- Line 29(ish): Since they've seen (and should be comfortable with) classes already, there might be a clearer way to present this material through the OOP lens of the third set of notes. That is, present the response upfront as an instance of a
Responseobject (which you do), then use subheadings to enumerate useful attributes and methods and present them as you would any other function (like you presented some of the functions in the Data Structures notes set). Perhaps this is just personal preference, but something with a little more structure would clarify my understanding as I went through the description of this object. - Line 41: Might want to make a quick note here that
r.okis a wrapper forr.status_code <= 200, and indicate that HTTP codes of less than or equal to 200 indicate that a request was successfully processed. - Line 47: "know that the response probably contains meaningful information" - I'm struggling to think of a counterexample where we make a successful request that doesn't contain any meaningful information. If the request goes through, then isn't
r.contentalways populated with page content? - Line 65: Small nit - we should refer to HTML as a markup language.
- Line 71: HTML is exciting, but not that exciting. Let's use a period. 😝
- Line 71 (and some prior lines): "but we're not going to do that right now" - this seems like a peculiar detour for something we aren't going to do right now.... or later in this notes set. Here, I'd recommend flagging BeautifulSoup and requests-html, to bring closure to the HTML side of things. Then, perhaps motivate our use of JSON before transitioning to that part of the discussion - explain that lots of APIs use JSON as a way to interact better with programming environments, for example.
- Line 75: I know we do this later, but to start, it could be cool to have a screenshot of this site from the browser, so students can see the content in plaintext in the browser page before querying the site using Python.
- Line 92: Change "to Python code" to "to a Python dictionary," and before you mention that, make the observation that JSON looks really really similar to Python dictionaries.
- Line 136: "This is really useful because most web programming languages aren't as powerful as Python." This is false, if we're going under the assumption that "power" refers to Turing completeness. If there's another definition of "power" that we're using here, let's perhaps add in some more specific phrasing to communicate specific intent. Honestly I'm not entirely sure what you are trying to convey in this statement.
- Line 163: Awesome job with this breakdown. This is really accessible and nice. And great work explaining the role of that decorator in such accessible language.
- Line 176: "The first line tells Flask to start
app.py..." This, strictly speaking, isn't true - it sets an environment variable to indicate to Flask which file to run when the server starts up. But the command does not "start" any file such asapp.py, so I'd recommend rephrasing to reduce ambiguity. - Line 236: Perhaps consider a small detailing of the
<name>syntax before dropping it straight into the example. - Line 288: I know we've seen all the pieces before, but since we're putting them together in a new way, it would be nice to have a brief overview (in English) of what's going on before dropping the reader straight into a code example - especially a code example that's just been flagged as "More Complex" by the section header.
- Line 329: This is a neat and fun example, but it's quite unclear to me where Jinja2 comes in. I don't see it imported in either of the files, nor do I see you pip install it anywhere. This should be clarified. Also... what actually is Jinja2? It's never really detailed.
- Line 365: There's all of a sudden a lot going on here, and a couple more links need to be drawn explicitly. I'd make the comparison here between HTML and the
.formatoperator, where you're basically interpreting the Jinja template as a string to which you apply the.formatfunction to fill in certain variables. It might also be good to draw the reader's eye toward the more useful elements of the HTML they see, such as the title and the link (and to explicitly flag what these are and why they're important), rather than the meta charset or the viewport name.
All in all, really excellent work - I love this set of notes! 😊
Metadata
Metadata
Assignees
Labels
No labels