OLD | NEW |
(Empty) | |
| 1 [![PyPI version](https://badge.fury.io/py/mozdownload.svg)](http://badge.fury.io
/py/mozdownload) |
| 2 [![Build Status](https://travis-ci.org/mozilla/mozdownload.svg?branch=master)](h
ttps://travis-ci.org/mozilla/mozdownload) |
| 3 [![Stories in Ready](https://badge.waffle.io/mozilla/mozdownload.png?label=ready
&title=Ready)](https://waffle.io/mozilla/mozdownload) |
| 4 |
| 5 # mozdownload |
| 6 |
| 7 [mozdownload](https://github.com/mozilla/mozdownload) |
| 8 is a [python package](http://pypi.python.org/pypi/mozdownload) |
| 9 which handles downloading of Mozilla applications. |
| 10 |
| 11 ## Installation |
| 12 |
| 13 If the tool should only be used for downloading applications we propose to |
| 14 install it via pip. The following command will install the latest release: |
| 15 |
| 16 pip install mozdownload |
| 17 |
| 18 Otherwise follow the steps below to setup a development environment. It is |
| 19 recommended that [virtualenv](http://virtualenv.readthedocs.org/en/latest/instal
lation.html) |
| 20 and [virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/en/latest/) |
| 21 be used in conjunction with mozdownload. Start by installing these. Then first f
ork |
| 22 our repository into your own github account, and run: |
| 23 |
| 24 git clone https://github.com/%your_account%/mozdownload.git |
| 25 cd mozdownload |
| 26 python setup.py develop |
| 27 |
| 28 More detailed developer documentation can be found in the [wiki](https://github.
com/mozilla/mozdownload/wiki). |
| 29 |
| 30 ## Command Line Usage |
| 31 |
| 32 The `mozdownload` command will download the application based on the provided |
| 33 command line options. |
| 34 |
| 35 ### Examples |
| 36 |
| 37 Download the latest official Firefox release for your platform (as long as there
is no |
| 38 64bit build of Firefox for Windows64, users on that platform have to download th
e 32bit build): |
| 39 |
| 40 mozdownload --version=latest |
| 41 |
| 42 Download the latest Firefox Aurora build for Windows (32bit): |
| 43 |
| 44 mozdownload --type=daily --branch=mozilla-aurora --platform=win32 |
| 45 |
| 46 Download the latest official Thunderbird release for your platform: |
| 47 |
| 48 mozdownload --application=thunderbird --version=latest |
| 49 |
| 50 Download the latest Earlybird build for Linux (64bit): |
| 51 |
| 52 mozdownload --application=thunderbird --type=daily --branch=comm-aurora --pl
atform=linux64 |
| 53 |
| 54 Download this README file: |
| 55 |
| 56 mozdownload --url=https://raw.github.com/mozilla/mozdownload/master/README.m
d |
| 57 |
| 58 Download a file from a URL protected with basic authentication: |
| 59 |
| 60 mozdownload --url=http://example.com/secrets.txt --username=admin --password
=password |
| 61 |
| 62 Run `mozdownload --help` for detailed information on the command line options. |
| 63 |
| 64 ### Command Line Options |
| 65 |
| 66 To see the full list of command line options, execute the command below and chec
k the list |
| 67 of options for the build type to download: |
| 68 |
| 69 mozdownload --help |
| 70 |
| 71 ## API |
| 72 |
| 73 Beside the CLI mozdownload also offers an API to be used. To create specific ins
tances of scrapers |
| 74 the FactoryScraper class can be used. Here some examples: |
| 75 |
| 76 # Create a release scraper for the German locale of Firefox 40.0.3 |
| 77 from mozdownload import FactoryScraper |
| 78 scraper = mozdownload.FactoryScraper('release', version='40.0.3', locale='de
') |
| 79 |
| 80 # Create a candidate scraper for Windows 32bit of Firefox 41.0b9 |
| 81 from mozdownload import FactoryScraper |
| 82 scraper = mozdownload.FactoryScraper('candidate', version='41.0b9', platform
='win32') |
| 83 |
| 84 # Create a daily scraper for the latest Dev Edition build on the current pla
tform |
| 85 from mozdownload import FactoryScraper |
| 86 scraper = mozdownload.FactoryScraper('daily', branch='mozilla-aurora') |
| 87 |
| 88 All those scraper instances allow you to retrieve the url which is used to downl
oad the files, and the filename for the local destination: |
| 89 |
| 90 from mozdownload import FactoryScraper |
| 91 scraper = mozdownload.FactoryScraper('daily') |
| 92 print scraper.url |
| 93 print scraper.filename |
| 94 |
| 95 To actually download the remote file the download() method has to be called: |
| 96 |
| 97 from mozdownload import FactoryScraper |
| 98 scraper = mozdownload.FactoryScraper('daily') |
| 99 filename = scraper.download() |
OLD | NEW |