How to do it

We proceed as follows:

  1. Execute the script for the recipe.  It contains the following code:
util = URLUtility(const.ApodEclipseImage())print("The content type is: " + util.contenttype)
  1. With the following result:
Reading URL: https://apod.nasa.gov/apod/image/1709/BT5643s.jpgRead 171014 bytesThe content type is: image/jpeg

Get Python Web Scraping Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.