11
22
3+ import builtins
4+
5+
36class ConfigValidator :
47 config = None
58
@@ -18,52 +21,52 @@ def validate(self):
1821 # Start urls must be an array
1922 if self .config .start_urls and not isinstance (self .config .start_urls ,
2023 list ):
21- raise Exception ('start_urls should be list' )
24+ raise builtins . Exception ('start_urls should be list' )
2225
2326 # Stop urls must be an array
2427 if self .config .stop_urls and not isinstance (self .config .stop_urls ,
2528 list ):
26- raise Exception ('stop_urls should be list' )
29+ raise builtins . Exception ('stop_urls should be list' )
2730
2831 # Custom settings must be a dict
2932 if self .config .custom_settings and not isinstance (self .config .custom_settings ,
3033 dict ):
31- raise Exception ('custom_settings must be a dictionary' )
34+ raise builtins . Exception ('custom_settings must be a dictionary' )
3235
3336 if self .config .js_render and not isinstance (self .config .js_render ,
3437 bool ):
35- raise Exception ('js_render should be boolean' )
38+ raise builtins . Exception ('js_render should be boolean' )
3639
3740 # `js_wait` is set to 0s by default unless it is specified
3841 if self .config .js_wait and not isinstance (self .config .js_wait , int ):
39- raise Exception ('js_wait should be integer' )
42+ raise builtins . Exception ('js_wait should be integer' )
4043
4144 if self .config .use_anchors and not isinstance (self .config .use_anchors ,
4245 bool ):
43- raise Exception ('use_anchors should be boolean' )
46+ raise builtins . Exception ('use_anchors should be boolean' )
4447
4548 if self .config .sitemap_alternate_links and not isinstance (
4649 self .config .sitemap_alternate_links , bool ):
47- raise Exception ('sitemap_alternate_links should be boolean' )
50+ raise builtins . Exception ('sitemap_alternate_links should be boolean' )
4851
4952 if self .config .sitemap_urls_regexs and not self .config .sitemap_urls :
50- raise Exception (
53+ raise builtins . Exception (
5154 'You gave an regex to parse sitemap but you didn\' t provide a sitemap url' )
5255
5356 if self .config .sitemap_urls_regexs and not self .config .sitemap_urls :
5457 for regex in self .config .sitemap_urls_regex :
5558 if not isinstance (regex , str ):
56- raise Exception (
59+ raise builtins . Exception (
5760 'You gave an bad regex: ' + regex + ' must be a string' )
5861
5962 if self .config .force_sitemap_urls_crawling and not self .config .sitemap_urls :
60- raise Exception (
63+ raise builtins . Exception (
6164 'You want to force the sitemap crawling but you didn\' t provide a sitemap url' )
6265
6366 if not self .config .scrape_start_urls and not self .config .scrap_start_urls :
64- raise Exception (
67+ raise builtins . Exception (
6568 'Please use only the new variable name: scrape_start_urls' )
6669
6770 if self .config .nb_hits_max and not isinstance (self .config .nb_hits_max ,
6871 int ):
69- raise Exception ('nb_hits_max should be integer' )
72+ raise builtins . Exception ('nb_hits_max should be integer' )
0 commit comments