Chapter 14 Assignment

Web Development & Scraping

Basic Questions (10)

  1. What is Flask and what is it used for?
  2. How do you create a basic route in Flask?
  3. What is FastAPI and how is it different from Flask?
  4. Explain the purpose of the @app.get() decorator in FastAPI.
  5. How do you install the requests library?
  6. What does the requests.get() function do?
  7. What is the role of BeautifulSoup in web scraping?
  8. How do you run a Flask app locally?
  9. How can you return JSON response in Flask?
  10. Explain the use of HTML templates in Flask.

Intermediate Questions (10)

  1. How do you pass URL parameters to Flask routes?
  2. Explain dependency injection in FastAPI with an example.
  3. How can you handle POST requests in Flask?
  4. Describe how to scrape all hyperlinks from a web page using BeautifulSoup.
  5. How do you handle form data submission in Flask?
  6. Explain how to use Pydantic models in FastAPI for request validation.
  7. What is the difference between find() and find_all() methods in BeautifulSoup?
  8. How can you manage CORS (Cross-Origin Resource Sharing) in FastAPI?
  9. How do you serve static files in a Flask application?
  10. Write a Flask route that returns a rendered HTML template passing dynamic data.

Advanced Questions (10)

  1. How do you implement asynchronous endpoints in FastAPI?
  2. Explain how to secure Flask APIs using JWT tokens.
  3. Describe scraping JavaScript rendered content and possible solutions.
  4. How can you deploy a Flask app using a production WSGI server like Gunicorn?
  5. Explain the use of background tasks in FastAPI.
  6. How do you handle pagination when scraping multiple web pages?
  7. Discuss the differences between Flask's synchronous model and FastAPI's asynchronous model.
  8. Write a FastAPI endpoint that accepts a JSON payload and validates it using Pydantic.
  9. How do you test Flask routes using the Flask testing client?
  10. Explain ethical considerations and legal issues related to web scraping.