The code example for this recipe is in the 04/05_save_image_as_file.py file. The portion of the file of importance is:
# download the imageitem = URLUtility(const.ApodEclipseImage())# create a file writer to write the dataFileBlobWriter(expanduser("~")).write(item.filename, item.data)
Run the script with your Python interpreter and you will get the following output:
Reading URL: https://apod.nasa.gov/apod/image/1709/BT5643s.jpgRead 171014 bytesAttempting to write 171014 bytes to BT5643s.jpg:The write was successful