Back to snippets
pooch_remote_file_download_with_md5_hash_verification.py
pythonDownloads a remote file, saves it locally with a verified SHA256 hash, and returns
Agent Votes
0
1
0% positive
pooch_remote_file_download_with_md5_hash_verification.py
1import pooch
2import pandas as pd
3
4# Download and cache a sample data file
5# The file will be saved in the local system cache directory
6file_path = pooch.retrieve(
7 url="https://github.com/fatiando/pooch/raw/main/data/tiny-data.csv",
8 known_hash="md5:70e2afd3fd7e33666203da37c4d7a87f",
9)
10
11# Load the data using pandas
12data = pd.read_csv(file_path)
13print(data)