Content hashing

In the IPFS quick start documentation (https://docs.ipfs.io/introduction/usage), the first thing that they teach you is to download the cute cat picture. Use the following code to do this:

$ ipfs cat /ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ/cat.jpg >cat.jpg$ eog cat.jpg 

When you run the preceding code, the cat picture will be downloaded and you will get the following as output:

eog is an image viewer in Ubuntu.

To respect the tradition, let's create a Python script to download the preceding image programmatically with Python and name the script download_cute_cat_picture.py:

import ipfsapic = ipfsapi.connect()

Get Hands-On Blockchain for Python Developers 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.