I need to download files from fki IAM Handwriting Database to a online notebook using Linux CLI or Python.
In order to download a file, the user needs to login before the download can begin.
Previously, it was possible to download the file as follows:
wget --user username --pass password https://fki.tic.heia-fr.ch/DBs/iamDB/data/words.tgz
In the updated version wget does not work. I also tried the following code:
url = 'https://fki.tic.heia-fr.ch/login'
values = {'username': 'user',
'password': 'pass'}
r = requests.post(url, data=values)
It returns Bad Requests [400].
P.S.: Please do not suggest downloading the database onto the local machine and uploading it to the server. I do not have access to highspeed download or upload.
So I was facing the same problem, what I did was the following:
wget --save-cookies cookies.txt \
--keep-session-cookies \
--post-data 'email=<INSERT YOUR EMAIL>&password=<INSERT YOUR PASSWORD>' \
--delete-after \
https://fki.tic.heia-fr.ch/login
this works for every website that requires a login procedure in order to download, just place the login or authentication link in the code above, while putting in the post-data the correct data, it is important to put the field name correctly, either it is email, username, userid, etc.. in order to find it, you have to go to the login page and right-click on the email/username field and click inspect and look for the name attribute, same applies for password. Make sure that the ampersand is codded correctly as per Percent Encoding.
P.S: you only have to run the cell above once.
Next, you have to run the following code:
!wget --load-cookies cookies.txt \
https://fki.tic.heia-fr.ch/DBs/iamDB/data/words.tgz
while using the link for the file you want to download itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With