Skip to content

Commit

Permalink
remove data retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
glibesyck committed Jul 1, 2024
1 parent 7410454 commit 1e49d70
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions tutorials/W1D2_ComparingTasks/W1D2_Tutorial3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -173,47 +173,6 @@
"logging.basicConfig(level=logging.INFO)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# @title Data retrieval\n",
"\n",
"import os\n",
"import requests\n",
"import hashlib\n",
"\n",
"# Variables for file and download URL\n",
"fname = \"trials.py\" # The name of the file to be downloaded\n",
"url = \"https://osf.io/swrmj/download\" # URL from where the file will be downloaded\n",
"expected_md5 = \"99bd315fd9a84663afbaa98f552cce79\" # MD5 hash for verifying file integrity\n",
"\n",
"if not os.path.isfile(fname):\n",
" try:\n",
" # Attempt to download the file\n",
" r = requests.get(url) # Make a GET request to the specified URL\n",
" except requests.ConnectionError:\n",
" # Handle connection errors during the download\n",
" print(\"!!! Failed to download data !!!\")\n",
" else:\n",
" # No connection errors, proceed to check the response\n",
" if r.status_code != requests.codes.ok:\n",
" # Check if the HTTP response status code indicates a successful download\n",
" print(\"!!! Failed to download data !!!\")\n",
" elif hashlib.md5(r.content).hexdigest() != expected_md5:\n",
" # Verify the integrity of the downloaded file using MD5 checksum\n",
" print(\"!!! Data download appears corrupted !!!\")\n",
" else:\n",
" # If download is successful and data is not corrupted, save the file\n",
" with open(fname, \"wb\") as fid:\n",
" fid.write(r.content) # Write the downloaded content to a file\n",
"\n",
"# Execute the downloaded Python file\n",
"%run trials.py"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit 1e49d70

Please sign in to comment.