Projects‎ > ‎

Project 6

You are writing a simple script that determines if a user-supplied URL can be retrieved. Just like the calculator, your script will loop until the user wants to exit.
  • Prompt the user for input
    • If the input types just "q" or "x" exit.
    • Everything else is treated as a URL
  • Attempt to retrieve the URL
  • Print the status code - only status codes of 200 indicate a successful retrieval
  • Optional extra credit: Print some additional information about the URL
  • Make sure that nothing "crashes" your script
You can base your script in two packages:

Requests

  • You can find the documentation at docs.python-requests.org
  • The package should be installed in Canopy, if not you will need to add it in the package manager
  • If you use the requests package, print the actual URL and the "status_code" as additional information.

urllib3

  • You can find the documentation at urllib3.readthedocs.io
  • The package should be installed in Canopy, if not you will need to add it in the package manager
  • If you use the urllib3 package, print the "info()" and the "status" as additional information.