Pywikibot is a Python-based framework to write bots for MediaWiki (more information).
Thanks to work in Google Code-in, Pywikibot now has a script called download_dump.py. It downloads a Wikimedia database dump from http://dumps.wikimedia.org/, and places the dump in a predictable directory for semi-automated use by other scripts and tests.
We should check that the file is not corrupted: compare downloaded file md5 and excepted one, delete the corrupted and retries if it fails, with a maxretries parameter.
File where md5 can be found: https://dumps.wikimedia.org/enwiki/latest/enwiki-latest-md5sums.txt (and this for each project).
If the md5 of the current filename cannot be found in the list, simply use pywikibot.warning('text') to show a warning and skip the verification.
You are expected to provide a patch in Wikimedia Gerrit. See https://www.mediawiki.org/wiki/Gerrit/Tutorial for how to set up Git and Gerrit.