Merge pull request #120 from bdossantos/fix/generate-blacklist-timeout

feat: add a flag to setup the open URL timeout
This commit is contained in:
Frank Denis 2018-02-11 20:24:40 +01:00 committed by GitHub
commit c7ec3ada15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -44,7 +44,7 @@ def list_from_url(url):
trusted = True
response = None
try:
response = urllib2.urlopen(req, timeout=10)
response = urllib2.urlopen(req, timeout=int(args.timeout))
except urllib2.URLError as err:
raise Exception("[{}] could not be loaded: {}\n".format(url, err))
if trusted is False and response.getcode() != 200:
@ -131,6 +131,8 @@ argp.add_argument("-w", "--whitelist", default="domains-whitelist.txt",
help="file containing a set of names to exclude from the blacklist")
argp.add_argument("-i", "--ignore-retrieval-failure", action='store_true',
help="generate list even if some urls couldn't be retrieved")
argp.add_argument("-t", "--timeout", default=10,
help="URL open timeout")
args = argp.parse_args()
conf = args.config