mozilla/mozdownload — pull request #78 by nthomas-mozilla (2013-05-13 00:31:57+00:00)
Title: Issue #77, support hidden candidates directories

* allows DirectoryParser to use auth by passing in an urllib2 opener
* move creation of urllib2 opener to Scraper.__init__ to share it between scraper.py and DirectoryParser. NB uses self.base_url rather than self.final_url

* if --build-number is passed for candidates then don't parse the parent directory for it, otherwise go look up the latest (public) dir
* fix up saved filename for above change

Testing: I've looked at the candidates case only:
# don't give a build-number or auth, find the latest public dir
$ mozdownload --type candidate --platform mac --locale de --version 21.0 --directory builds
Retrieving list of candidate builds from https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/21.0-candidates/
Downloading from: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/21.0-candidates/build3/mac/de/Firefox 21.0.dmg
# builds/firefox-21.0-build3.de.mac.dmg

# get a hidden dir by passing build-number and auth (fake auth)
$ mozdownload --type candidate --platform mac --locale de --version 21.0 --directory builds --build-number 2 --username=### --password=###
Downloading from: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/21.0-candidates/build2/mac/de/Firefox 21.0.dmg
# builds/firefox-21.0-build2.de.mac.dmg

# get an older public build by specifying build-number
$ mozdownload --type candidate --platform mac --locale de --version 21.0 --directory builds --build-number 1
Downloading from: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/21.0-candidates/build1/mac/de/Firefox 21.0.dmg
# builds/firefox-21.0-build1.de.mac.dmg