Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Download data.zip programmatically for "Loophole-free Bell-inequality violation using electron spins separated by 1.3 kilometres" experiment

I would like to create a gist or a Jupyter notebook analyzing the data located at Loophole-free Bell-inequality violation using electron spins separated by 1.3 kilometres. The site has this download button

enter image description here

which right-clicking to copy-paste the link tells me it associated with the URL https://data.4tu.nl/ndownloader/files/24056582. If I copy-paste this URL into Firefox it downloads the file. I would like to do this with Python.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I figured I would try making a request to that link with the following.

import requests
requests.get('https://data.4tu.nl/ndownloader/files/24056582')

But the above did not seem to download data.zip as desired. How can I use Python to programmatically download data.zip into the local path of my Python script?

>Solution :

Try:

import requests

r = requests.get("https://data.4tu.nl/ndownloader/files/24056582")

with open("data.zip", "wb") as f_out:
    f_out.write(r.content)

This downloads the data.zip:

-rw-r--r-- 1 root root 152913 okt 17 00:35 data.zip
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading