Created
November 10, 2020 14:16
-
-
Save amacal/232f70650eace61e3ed0b96294324376 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ftplib import FTP | |
from hashlib import md5, sha1 | |
ftp = FTP('ftp.acc.umu.se') | |
ftp.login() | |
ftp.cwd('mirror/wikimedia.org/dumps/enwiki/20201020/') | |
filename = 'enwiki-20201020-langlinks.sql.gz' | |
md5data = md5() | |
sha1data = sha1() | |
ftp.retrbinary(f'RETR {filename}', lambda data: ( | |
md5data.update(data), | |
sha1data.update(data) | |
)) | |
ftp.quit() | |
assert md5data.digest() == bytes.fromhex('ad1eca2f492665d5757ce8a3b8e6c70f') | |
assert sha1data.digest() == bytes.fromhex('9a0ad7d077d4fddf64f82479f7537429355c1ee0') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment