mozilla/mozdownload — pull request #59 by Nebelhom (2013-03-12 12:20:34+00:00)
Title: Issue#50: Implement a download timeout

This Pull Request addresses Issue #50:

The main thing to note here is that I changed the use of urllib to urllib2 in parser.py line 21.

It works fine for this particular use, but I am unsure if it may break something elsewhere in the code. Everything else is pretty straight forward. The changes are summarised below.

thanks folks.

parser.py:
- added import urllib2
- changed line 21 to urllib2.urlopen(url, timeout=60)

scraper.py:
- added self.timeout attribute to Scraper class (default 600)
- added timeout=self.timeout param to line 194
- added a --timeout flag to CLI