File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python
2+ import argparse
23import multiprocessing as mp
34import os
45import json
@@ -97,7 +98,28 @@ def bad_url(url_status):
9798 return False
9899
99100
101+
102+ def parse_args (argv ):
103+ parser = argparse .ArgumentParser (
104+ description = 'Check correctness of url links.' ,
105+ add_help = True )
106+ parser .add_argument (
107+ 'url-timeout' ,
108+ default = 10.0 ,
109+ help = 'Timeout in seconds to wait for link' )
110+ parser .add_argument (
111+ 'url-retries' ,
112+ default = 10 ,
113+ help = 'Number of link retries' )
114+ parser .add_argument (
115+ 'num-threads' ,
116+ default = mp .cpu_count ()* 4 ,
117+ help = 'Number of threads to run with' )
118+ return parser .parse_args (argv )
119+
120+
100121def main ():
122+ args = parse_args (sys .argv [1 :])
101123 print ('Extract urls...' )
102124 all_urls = extract_urls (os .getcwd () + os .path .sep + 'content' )
103125 print ('\n Check urls...' )
You can’t perform that action at this time.
0 commit comments