Create a new Flask application with the following:
- A
base.html
template for others to inherit from - A route for
/person/<name>/<age>
which renders a template that displays the name and age entered for the URL. That template should inherit frombase.html
Refactor your calculator application from before!
- have a route for
/calculate
which renders a template calledcalc.html
- in
calc.html
, build a form which has two inputs (one with a name ofnum1
and another with the name ofnum2
for numbers and a select field with the name ofcalculation
with options for "add", "subract", "multiply" and "divide". - When the form is submitted it should make a request to a route called
/math
- In your python file, accept the values from the form and depending on what the request contains, respond with the sum, difference, product or quotient.
Create a small application which grabs headlines from Google News by keyword. (This application is based on the Google News web scraper from the web scraping exercises.)
- This application should consist of two routes,
/
and/results
- When the server receives a request to
/
, it should render an HTML page with a form prompting the user for a keyword (e.g. "California"). Submitting the form should result in a request to/results
, with the form input passed in the query string. - When the server receives a request to
/results
, it should do the following:- Grab the keyword from the query string;
- Make a request to
https://news.google.com
, and scrape the respose HTML for all news articles (links and headlines); - Filter out articles whose headlines do not match the keyword passed in from the query string;
- Render an HTML page with matching articles (links and headlines) in a list.